当pip.conf指定其他位置时,为什么pip试图到达pypi.python.org?

时间:2019-01-22 09:43:29

标签: python pip

我的组织使用工件,这是本地程序包存储库管理器。 Artifactory提供了一项称为“远程存储库”的功能,该功能为远程存储库提供代理和缓存功能,我们将其用于代理和缓存对PyPi的访问(有关更多详细信息,请参见PyPi Repositories)。

要使用此远程存储库,必须将一个条目添加到pip.conf。我已经在需要安装一些机器的盒子上完成了此操作,但是当我发出pip命令(在我的情况下,其sudo -E pip install --ignore-installed pip setuptools wheel)中,pip似乎忽略了pip.conf中的内容,而是试图进入https://pypi.python.org

这是我刚运行的内容的记录:

$ cat /etc/pip.conf  
[global]  
index-url = https://username:password@artifactory.myorg.com/artifactory/api/pypi/pypi-remote/simple  

$ sudo -E pip
install --ignore-installed pip setuptools wheel  
Downloading/unpacking pip  
  Cannot fetch index base URL https://pypi.python.org/simple/   
  Could not find any downloads that satisfy the requirement pip  
Cleaning up...  
No distributions at all found for pip  
Storing debug log for failure in /home/jamiet/.pip/pip.log  

$ cat /home/jamiet/.pip/pip.log   
Downloading/unpacking pip   
   Getting page https://pypi.python.org/simple/pip/
   Could not fetch URL https://pypi.python.org/simple/pip/: connection error: ('Connection aborted.', error(101, 'Network is unreachable'))
  Will skip URL https://pypi.python.org/simple/pip/ when looking for download links for pip  
   Getting page https://pypi.python.org/simple/   Could not
fetch URL https://pypi.python.org/simple/: connection error:
('Connection aborted.', error(101, 'Network is unreachable'))
  Will skip URL https://pypi.python.org/simple/ when looking for download
links for pip
  Cannot fetch index base URL https://pypi.python.org/simple/  
  URLs to search for versions for pip:
* https://pypi.python.org/simple/pip/  
  Getting page https://pypi.python.org/simple/pip/  
  Could not fetch URL https://pypi.python.org/simple/pip/: connection error: ('Connection
aborted.', error(101, 'Network is unreachable'))  
  Will skip URL https://pypi.python.org/simple/pip/ when looking for download link for pip  
  Could not find any downloads that satisfy the requirement pip  
Cleaning up... No distributions at all found for pip  

有人能向我解释为什么pip.conf指示到达其他地方时pip试图到达https://pypi.python.org/simple/pip/吗?

1 个答案:

答案 0 :(得分:0)

我们使用的旧版pip 1.5.6于2014年5月发布。当我们在命令行sudo -E pip install --index-url https://username:password@artifactory.myorg.com/artifactory/api/pypi/pypi-remote/simple --ignore-installed pip setuptools wheel上指定index-url时,一切正常,因此我们假设这个旧版本的pip不会使用pip.conf,或者如果使用,则不会以相同的方式使用它。

该命令(升级pip)一旦成功完成,随后在同一脚本中对pip的后续调用就不需要指定--index-url,因为它们按预期使用了pip.conf。