python - Pip 卡在 "collecting numpy"

标签 python python-3.x numpy pip

尝试在 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,这就是它失败的原因?

最佳答案

我对 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按预期工作,缓存又开始自行重建。

来自docs您可以根据您的操作系统找到缓存所在的路径:

The default location for the cache directory depends on the Operating System:

Unix

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

macOS

~/Library/Caches/pip.

Windows

<CSIDL_LOCAL_APPDATA>\pip\Cache

关于python - Pip 卡在 "collecting numpy",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54687610/

相关文章:

python-3.x - 如何使用python3将HTML转换为PDF

python - 在 numpy 中按值拆分数组

python - 从 txt 文件绘制简单图形 python

python - 如何通过在最后一个元素处拆分数组来将一维数组拆分为 NumPy 中的二维数组?

python - 如何在 python 中遍历列表时删除 None

python - 使用 python,从字符串中删除 HTML 标签/格式

python - 在 django 模板中显示单个表单字段?

python - 如何在pyspark中对数组中的标签进行编码

python - 尝试使用 Python 3.7.2 pip 安装包会导致 TSL/SSL 错误

python - 为什么 .copy 和 .clear 方法不是序列抽象基类规范的一部分?