从哪个存储库安装pip包?

时间:2018-04-25 16:07:09

标签: python pip

我需要使用pip下载一个包。我跑了pip install <package>,但收到了以下错误:

[user@server ~]$ pip install sistr_cmd
Collecting sistr_cmd
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cd90>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c290>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c510>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0cf10>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x7f518ee0c190>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/sistr-cmd/

  Could not find a version that satisfies the requirement sistr_cmd (from versions: )
No matching distribution found for sistr_cmd

我确认问题的根源是网络阻塞了大多数网站,因为我在代理服务器后面工作(组织要求)。为了允许这些下载,我需要编译下载源的URL列表,并将其发送给网络管理员以取消阻止。

根据pip文档(在维基百科的pip文章中引用和解释),“许多软件包都可以在软件包及其依赖项的默认源代码中找到 - Python软件包索引(PyPI),&#34;所以我去了Biopython的PyPI页面,找到了github存储库和包所需的依赖项。 PyPI页面上还有下载链接,我想确保允许下载所有源。从包的原始源(github存储库或托管原始软件包的任何位置),下载的PyPI页面中列出的软件包,或者是否通过它们进行搜索来进行pip安装吗?

提前感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

它似乎是一个网络连接,稍后您可以尝试下面:

pip install sistr-cmd 有关详细信息,请参阅-_之间的区别here

答案 1 :(得分:0)

根据用户abarnert

&#34;如果您使用pip标记运行--verbose,它会显示它考虑的所有链接。一般来说,它首先转到https://pypi.org/simple/{PACKAGE}。该页面将包含指向维护者上传的所有版本的轮子和源的下载链接,并且它将通过按顺序尝试其链接来查找适当版本的轮子。通常没有列出github回购作为来源 如果你想安装你知道的github(或任何其他位置)的所有内容,最简单的方法是手动将repo提供给pip而不仅仅是包名。理想情况下,将您关心的所有内容安装在没有从大多数互联网上防火墙的机器上,构建一个requirements.txt文件(如here所述),然后将该需求文件复制到防火墙机器并尝试安装它。&#34;

使用pip install标志运行--verbose会显示有关从中提取程序包的位置以及网络连接和回溯的详细信息。

相关问题