我正在尝试使用 pip 安装几个软件包。当我使用 sudo 执行此操作时,会发生此错误:“无法获取索引基础 URL https://pypi.python.org/simple/”。当我在没有 sudo 的情况下执行命令时,包下载成功,但我没有足够的权限。这种不同行为的原因可能是什么?我坐在代理后面。
最佳答案
也许试试 sudo -E
:
-E The -E (preserve environment) option indicates to the secu‐
rity policy that the user wishes to preserve their existing
environment variables. The security policy may return an
error if the -E option is specified and the user does not
have permission to preserve the environment.
假设您的代理设置是在您的正常用户环境中设置的,而不是您在运行 sudo
时获得的设置。
关于Python pip 错误 : "Cannot fetch index base URL https://pypi.python.org/simple/",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15501133/