pip包是从哪个存储库安装的?

2024-05-23 17:08:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要用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 Wikipedia文章中的引用和简要解释),“许多包都可以在包及其依赖项的默认源中找到——Python包索引(PyPI)”,所以我转到Biopython的PyPI页面,找到了github库和包所需的依赖项。PyPI页面上也有下载链接,我希望确保所有下载源都是允许的。那么pip是从一个包的原始源(github存储库或原始包所在的任何地方)安装的,这些包是在PyPI页面的下载下列出的,还是在两者中都搜索?在

提前谢谢你的帮助。在


Tags: pipcmdnonereadbyconnectconnectionredirect
2条回答

它显示为网络连接,稍后您可以尝试以下操作:

pip install sistr-cmd 查看-_之间的区别,了解更多信息检查here

根据用户abarnert

“如果使用 verbose标志运行pip,它将显示它考虑的所有链接。一般来说,它先到https://pypi.org/simple/{PACKAGE}。该页面将有指向wheels的下载链接和维护人员上载的所有版本的源代码,它将通过按顺序尝试其链接来查找相应版本的wheel。通常不会将github回购列为源。
如果您想从github(或任何其他位置)安装您知道的所有内容,最简单的方法是手动将repo传递给pip,而不仅仅是包名。理想情况下,把你关心的一切都安装在一台机器上,而这台机器不是从大多数互联网上安装防火墙的,构建一个要求.txt文件(如所述here),然后将该需求文件复制到防火墙计算机并尝试安装它。”

运行带有 verbose标志的pip install将显示有关从何处提取包以及有关网络连接和回溯的详细信息。在

相关问题 更多 >