为什么“pip install lxml”不使用提供的*,并尝试编译?

问题描述:

A wheel是分发预编译包以便通过pip安装的新方式。为什么“pip install lxml”不使用提供的*,并尝试编译?

lxml entry on pypi有*可用于“manylinux”。我正在运行Ubuntu。

但是,当我尝试pip安装lxml时,似乎无论如何尝试编译。任何想法为什么?

mktmpenv 
pip install lxml==3.6.4 

Collecting lxml==3.6.4 
    Using cached lxml-3.6.4.tar.gz 
Building wheels for collected packages: lxml 
    Running setup.py bdist_wheel for lxml 

    Complete output from command /home/harry/.virtualenvs/tmp-940224e01c89b3f0/bin/python3 -c "import setuptools;__file__='/tmp/pip-build-gxw05tyo/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp78u4a871pip-wheel-: 
    Building lxml version .... 
    Building lxml version 3.6.4. 
    Building without Cython. 
    Using build configuration of libxslt 1.1.29 
    running bdist_wheel 
    running build 
    running build_py 
    creating build 
    creating build/lib.linux-x86_64-3.5 
[...etc] 

任何想法?

+0

一些模块用C/C++代码和作者决定不编译它。你不要自己编译 - pip会为你做。我从来没有在Linux Mint上编译lxml的问题(基于Ubuntu 14.04) – furas

+0

如果你想预先定义lxml然后使用[Anaconda](https://docs.continuum.io/anaconda/pkg-docs) - 它会安装Python和已经为此Python版本预编译了lxml和其他模块。 – furas

+0

谢谢@furas,我实际上可以安装这个软件包,我的问题是关于为什么即使预编译轮可用,pip也想编译。澄清了我的帖子。 – hwjp

谢谢大家!所以我想我找到了答案。实际上这里有两个问题,第一个是我最初遇到这个bug的时候,第二个是我创建最小再现器的时候(我在q中发布的)。

  • 在最小的清样,PIP被发现的来源的名为.tar.gz缓存版本,而只是使用而不是在线检查任何车轮。 (HT @oldmanuk和@furas发现这一点)。 Aaaaaaararably这是一个错误?无论如何,经验教训,我最小的repro不是。

  • 在原始问题中,我在Ubuntu Trusty。我知道老版本的pip不能很好地执行*(比较@lukasa,@_rami_)。我曾预料到过,并且在我的剧本中有一个pip install --upgrade pip。我没有注意到的是,它实际上失败的消息Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS(按this issue),所以我仍然在1.5.4的点,这是忽略*。

所以最终修复是手动强制PIP的重新安装与

apt-get remove -y python-pip 
wget -q https://bootstrap.pypa.io/get-pip.py 
python get-pip.py # upgrade system pip to make sure we use wheels