尝试在 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 许可协议
我和 Django 有同样的问题。
这两个命令的输出差异如下:
使用
--no-cache-dir
只是绕过了这个问题。当我手动删除缓存目录的内容时,解决方案就来了。
rm -Rf ~/.cache/pip/*
允许pip install Django
按预期工作,并且缓存再次开始重建自身。根据您的操作系统,您可以从 文档 中找到缓存所在的路径: