点子挂在“收集numpy”上

Mos*_*eyi 7 python numpy pip python-3.x

尝试在Windows 10计算机和python 3.7.2中为python安装软件包。我正在使用以下命令:

pip install numpy
Run Code Online (Sandbox Code Playgroud)

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

pip -vvv install numpy
Run Code Online (Sandbox Code Playgroud)

结果如下:

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
Run Code Online (Sandbox Code Playgroud)

我试图进行研究,但找不到任何东西。我不敢相信只有这个软件包会通过HTTPS,这就是为什么它失败了?

rar*_*iru 8

我对 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>
Run Code Online (Sandbox Code Playgroud)

使用--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