什么时候“pip install"造轮子? [英] When does "pip install" build a wheel?

查看:84
本文介绍了什么时候“pip install"造轮子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在不同的文件夹中,有时 pip install 会构建轮子,这需要很多时间,而有时则不会.我不确定为什么以及如何控制它.

我的命令:bin/python -m pip install -r ../requirements.txt(由于 !# shebang 行长度限制,所以我不不要直接使用pip)

无需构建轮子的输出(只需几秒钟):

收集 numpy==1.10.4(来自 -r ../requirements.txt(第 1 行))安装收集的软件包:numpy成功安装 numpy-1.10.4

带构建轮的输出(至少需要2分钟)

收集 numpy==1.10.4(来自 -r ../requirements.txt(第 1 行))下载 numpy-1.10.4.tar.gz (4.1MB)100% |████████████████████████████████|4.1MB 92kB/秒为收集的包构建轮子:numpy为 numpy 运行 setup.py bdist_wheel ... 完成存放在目录:/root/.cache/pip/wheels/66/f5/d7/f6ddd78b61037fcb51a3e32c9cd276e292343cdd62d5384efd成功构建numpy安装收集的软件包:numpy成功安装 numpy-1.10.4

requirements.txt的内容:

numpy==1.10.4

解决方案

这取决于你的包是纯 python 包(不需要编译任何东西,只需将文件复制到某处即可)还是包含 c 源代码的包代码(在这种情况下需要编译并调用和执行编译器,这需要更长的时间).

http://pythonwheels.com/

您可能还想看看车轮文档:

http://wheel.readthedocs.org/en/latest/>

I found that in different folders, sometimes pip install will build wheel which takes a lot of time, while sometimes it doesn't. I'm not sure why and how to control that.

My command: bin/python -m pip install -r ../requirements.txt (due to the !# shebang line-length limitation, so I don't use pip directly)

The output without building a wheel (just takes a few seconds):

Collecting numpy==1.10.4 (from -r ../requirements.txt (line 1))
Installing collected packages: numpy
Successfully installed numpy-1.10.4

The output with building wheel (take at least 2 minutes)

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

The contents of requirements.txt:

numpy==1.10.4

解决方案

This depends on whether your package is a pure python package (without the need to compile anything, just copy the files somewhere) or a package which also includes c source code (in which case a compilation is necessary and a compiler is called and executed, which takes longer).

http://pythonwheels.com/

You may also want to have a look at the wheel docu:

http://wheel.readthedocs.org/en/latest/

这篇关于什么时候“pip install"造轮子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆