我已经在我的机器上安装了anaconda
和python 3.7,pip版本19.0.3
我正在尝试从Windows命令行进行pip安装。我通过pip尝试了所有包安装的错误。如果有人可以帮助我,那将是很棒的。
命令给出:pip install lifetimes
错误信息:
Collecting lifetimes
Could not install packages due to an EnvironmentError: Please check proxy URL. It is malformed and could be missing the host.
要在代理后面使用pip,可以使用--proxy
选项指定代理。
pip install --proxy=https://user:pass@server:port packages
如果您要在给定会话中执行多个pip安装,则可以在终端或命令提示符中设置代理变量。以下几行取自here。如果你有能力定义环境变量,那就做一次,你应该好好去。
# Windows
set http_proxy=http://[username:password@]proxyserver:port
set http_proxy=https://[username:password@]proxyserver:port
# Linux
export https_proxy=https://[username:password@]proxyserver:port
在工作中,我们仍然有一些问题,因为有些域不受信任,所以你可以添加以下行来告诉pip以下域是可以的。
--trusted-host pypi.python.org
--trusted-host files.pythonhosted.org
--trusted-host pypi.org
如果要设置Anaconda以使用代理而不必每次都指定代理,则需要在主目录中创建.condarc
文件。将以下行添加到.condarc
文件中,您应该很高兴。更多信息可以在here找到。
proxy_servers:
http: http://user:pass@server:port
https: https://user:pass@server:port