Python 有时pip安装很慢

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35144103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 16:02:51  来源:igfitidea点击:

Sometimes pip install is very slow

pythonpip

提问by zjffdu

I am sure it is not network issue. Some of my machine install packages using pip is very fast while some other machine is pretty slow, from the logs, I suspect the slow is due to it will compile the package, I am wondering how can I avoid this compilation to make the pip installation fast. Here's the logs from the slow pip installation.

我确定不是网络问题。我的一些机器使用 pip 安装包非常快,而另一些机器很慢,从日志中,我怀疑速度慢是因为它会编译包,我想知道如何避免这种编译来进行 pip 安装快速地。这是来自缓慢 pip 安装的日志。

Collecting numpy==1.10.4 (from -r requirements.txt (line 1))
  Downloading numpy-1.10.4.tar.gz (4.1MB)
    100% |████████████████████████████████| 4.1MB 95kB/s
Requirement already satisfied (use --upgrade to upgrade): wheel==0.26.0 in ./lib/python2.7/site-packages (from -r requirements.txt (line 2))
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... -
done
  Stored in directory: /root/.cache/pip/wheels/66/f5/d7/f6ddd78b61037fcb51a3e32c9cd276e292343cdd62d5384efd
Successfully built numpy

回答by code_onkel

The slowness is due to compilation indeed. But there is now the manylinux tag. Which allows the installation of pre-compiled distributions. See for example the PyPI page of numpyto see if a manylinux package is provided for your Python version.

缓慢确实是由于编译。但是现在有了 manylinux 标签。这允许安装预编译的发行版。例如,请参阅numpyPyPI 页面以查看是否为您的 Python 版本提供了 manylinux 包。

回答by Ans Hafeez

Try this.

尝试这个。

sudo apt-get install python-numpy

Worked for me.

为我工作。

回答by Ramy Rabie

in windows command line

在 Windows 命令行中

Instead of (too slow to complete)

而不是(太慢无法完成)

python -m pip install numpy

This worked (fast as supposed to be)

这有效(应该很快)

pip install numpy

checky by opening -in cmd-

通过打开-in cmd-来检查

python

import numpy as np 

(it shouldn't give any errors)

(它不应该给出任何错误)