更新时间:2022-06-13 06:03:32
我发现这是一个pip代理错误,并且能够通过将代理指定为pip安装的参数来解决此问题.因此,不仅仅是拥有
I have found out that this is a pip proxy error and was able to solve the issue by specifying the proxy as a parameter to pip install. So instead of simply having
#Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt
在我的Dockerfile
中,我有
#Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt --proxy http(s)://proxy:8080 --trusted-host pypi.python.org
--proxy http(s)://proxy:8080
指定pip使用的代理,并且--trusted-host pypi.python.org
启用pypi作为受信任的主机,以防万一遇到ssl证书错误(在公司环境中很常见).
The --proxy http(s)://proxy:8080
specifies the proxy to be used by pip and --trusted-host pypi.python.org
enables pypi as a trusted host just in case ssl certificate errors are encountered (common in corporate environments).