3

するとき:

$ sudo pypy -m easy_install lxml

応答は次のとおりです。

Searching for lxml

[...snip...]

ERROR: /bin/sh: 1: xslt-config: not found

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt 
/usr/lib/pypy/lib-python/2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
warning: no files found matching '*.txt' under directory 'src/lxml/tests'
src/lxml/lxml.etree.c:8:22: fatal error: pyconfig.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'cc' failed with exit status 1

同時に、正常にsudo pip install lxml動作します。

どうしたの?

ありがとう。

4

4 に答える 4

7

sudo apt-get install python-devubuntu 13.04で修正しました

于 2013-09-27T00:58:06.513 に答える
2

この問題は、Ubuntu パッケージをインストールすることで処理しましたpypy-dev

于 2014-07-25T13:05:52.000 に答える
2

私はこのトラブルに数回遭遇しました。

簡潔な答え

Python2: $ python2.7 setup.py clean build --with-cython install
Python3: $ pip-3.3 install lxml

長い答え

pip install lxmlPython2 と Python3 のどちらを使用しているかに関係なく、すべての環境で動作するはずです。

考慮すべきこともあります。関連するパフォーマンスの向上により、コンパイルをCython確実に楽しむことができます。lxmlCython

理由は不明ですが、Python2 でのコンパイルでは Cython が見つかりません。この問題についてより正確かつ完全に明確にするために、以下の両方のコマンドは Cython を使用しません。

# DO NOT use these commands. I repeat: DO NOT use these commands.
$ pip-2.7 install lxml
$ easy_install-2.7 install lxml

したがって、Python2 を使用する場合、私の知る限り、代替手段は 1 つしかありません。それは、ソースからコンパイルすることです、Luke!

# install build environment and dependencies
$ kernel_release=$( uname -r )
$ sudo apt-get install linux-headers-${kernel_release} build-essential -y
$ sudo apt-get install libxml2-dev libxslt1-dev -y

# Download from github and compile from sources
$ git clone --branch lxml-3.2.4 https://github.com/lxml/lxml
$ python2.7 setup.py clean build --with-cython install
于 2013-11-25T17:18:52.583 に答える