Pip 挂在“收集 numpy”上

新手上路,请多包涵

尝试在 Windows 10 机器和 python 3.7.2 中安装 python 包。我正在使用以下命令:

 pip install numpy

它永远挂着。我尝试使用以下方法获取更多信息:

 pip -vvv install numpy

结果如下:

 Collecting numpy
  1 location(s) to search for versions of numpy:
  * https://pypi.org/simple/numpy/
  Getting page https://pypi.org/simple/numpy/
  Looking up "https://pypi.org/simple/numpy/" in the cache
  Request header has "max_age" as 0, cache bypassed
  Starting new HTTPS connection (1): pypi.org:443
  https://pypi.org:443 "GET /simple/numpy/ HTTP/1.1" 304 0

我试图研究它,但找不到任何东西。我不敢相信只有这个包会通过 HTTPS,这就是它失败的原因?

原文由 Moseleyi 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 559
2 个回答

我和 Django 有同样的问题。

这两个命令的输出差异如下:

 pip install Django -vvv
...
Looking up "https://pypi.org/simple/django/" in the cache
Request header has "max_age" as 0, cache bypassed
https://pypi.org:443 "GET /simple/django/ HTTP/1.1" 304 0
<hangs here>

$ pip install Django --no-cache-dir -vvv
...
https://pypi.org:443 "GET /simple/django/ HTTP/1.1" 200 27460
<continues and successfully installs>

使用 --no-cache-dir 只是绕过了这个问题。

当我手动删除缓存目录的内容时,解决方案就来了。

rm -Rf ~/.cache/pip/* 允许 pip install Django 按预期工作,并且缓存再次开始重建自身。

根据您的操作系统,您可以从 文档 中找到缓存所在的路径:

缓存目录的默认位置取决于操作系统:

Unix

~/.cache/pip and it respects the XDG_CACHE_HOME directory

苹果系统

~/Library/Caches/pip

视窗

<CSIDL_LOCAL_APPDATA>\pip\Cache

原文由 raratiru 发布,翻译遵循 CC BY-SA 4.0 许可协议

IPv6 以某种方式为我造成了这个问题。在我的设备上禁用 ipv6 网络后,命令运行正常!

原文由 Sush 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题