首页 > 解决方案 > 在 conda 环境中安装 pip

问题描述

我在 condarc 文件中有以下设置:

ssl_verify: true
use_pip: True
add_pip_as_python_dependency: True
channels:
  - conda-forge
  - defaults
proxy_servers:
  http: proxyserver
  https: proxyserver

我在公司代理后面使用 Anaconda,在 http: 和 https: 字段下提到了有关代理服务器的这些详细信息。

一旦我激活环境并发出以下命令:

pip install -r requirements.txt 

我收到以下错误:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after 
connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 
0x000002A615C950D0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/jinja2/

标签: pipconda

解决方案


对我来说,这似乎是一个 SSL 错误。我通过绕过来修复它,如下所示:

pip install -r requirements.txt —trusted-host pypi.org —trusted-host files.pythonhosted.org

如果您在公司网络中,则可能由于防火墙阻塞而发生。试试上面的解决方案。


推荐阅读