使用pip的libxml安装错误

这是我的错误:


(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install lxml

Downloading/unpacking lxml

  Running setup.py egg_info for package lxml

    Building lxml version 2.3.

    Building without Cython.

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


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


    Using build configuration of libxslt

Installing collected packages: lxml

  Running setup.py install for lxml

    Building lxml version 2.3.

    Building without Cython.

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


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


    Using build configuration of libxslt

    building 'lxml.etree' extension

    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w

    src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录

    compilation terminated.

    error: command 'gcc' failed with exit status 1

    Complete output from command /home/zjm1126/zjm_test/mysite/bin/python -c "import setuptools;__file__='/home/zjm1126/zjm_test/mysite/build/lxml/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-jOhgvD-record/install-record.txt --install-headers /home/zjm1126/zjm_test/mysite/include/site/python2.6:

    Building lxml version 2.3.


Building without Cython.


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




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




Using build configuration of libxslt


running install


running build


running build_py


running build_ext


building 'lxml.etree' extension


gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-i686-2.6/src/lxml/lxml.etree.o -w


src/lxml/lxml.etree.c:4: fatal error: Python.h: 没有那个文件或目录


compilation terminated.


error: command 'gcc' failed with exit status 1

我能做什么?


幕布斯7119047
浏览 3532回答 3
3回答

慕斯709654

**确保已安装libxml2和libxslt的开发包**从lxml文档中,假设您正在运行基于Debian的发行版:sudo apt-get install libxml2-dev libxslt-dev python-dev对于基于Debian的系统,它应该是足够安装已知的生成依赖python-lxml或者python3-lxml,如sudo apt-get build-dep python3-lxml

慕莱坞森

如果您使用的是Ubuntu / Lubuntu 13.04或Ubuntu 13.10,并且遇到“ / usr / bin / ld:找不到-lz”的问题,则可能还需要安装zlib1g-dev软件包:sudo apt-get install -y zlib1g-dev放在一起:sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pipsudo pip3 install lxml

三国纷争

不,您缺少Python头文件。当您使用系统Python时,这通常会在Linux上发生(有理由不这样做,但这是一个不同的问题)。您可能需要安装一些软件包,它可能称为python-dev或python-devel。 sudo yum install python-devel要么 sudo aptitude install python-dev或类似的东西。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python