我发现在不同的文件夹中,有时 pip install
会构建轮子,这会花费很多时间,而有时则不会。我不确定为什么以及如何控制它。
我的命令: bin/python -m pip install -r ../requirements.txt
(由于 !#
shebang行长限制,所以我不直接使用pip)
不造轮子的输出(只需要几秒钟):
Collecting numpy==1.10.4 (from -r ../requirements.txt (line 1))
Installing collected packages: numpy
Successfully installed numpy-1.10.4
构建轮的输出(至少需要 2 分钟)
Collecting numpy==1.10.4 (from -r ../requirements.txt (line 1))
Downloading numpy-1.10.4.tar.gz (4.1MB)
100% |████████████████████████████████| 4.1MB 92kB/s
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
Installing collected packages: numpy
Successfully installed numpy-1.10.4
requirements.txt
的内容:
numpy==1.10.4
原文由 zjffdu 发布,翻译遵循 CC BY-SA 4.0 许可协议
这取决于你的包是纯python包(不需要编译任何东西,只需将文件复制到某处)还是包含c源代码的包(在这种情况下需要编译并调用并执行编译器,这需要更长的时间)。
http://pythonwheels.com/
您可能还想看看 wheel 文档:
http://wheel.readthedocs.org/en/latest/