Compilation Debian 7.4-LXML编译在Python 3.4.0中失败

Compilation Debian 7.4-LXML编译在Python 3.4.0中失败,compilation,debian,lxml,python-3.4,Compilation,Debian,Lxml,Python 3.4,我刚刚在我的电脑上安装了Debian 7.4。我需要python 3.3.2或更高版本和python3 lxml来进行内部开发。由于python3.2是debian wheezy中python3.x系列的基线,因此我编译了一个3.4.0 python版本并卸载了旧的3.2。(请注意,该进程还卸载了一些gnome依赖项) 工作完成后,Python3软件包(例如cherrypy)安装良好,模块可以成功导入解释器中 当尝试安装python3 lxml时,系统需要安装lxml存储库依赖项python3.

我刚刚在我的电脑上安装了Debian 7.4。我需要python 3.3.2或更高版本和python3 lxml来进行内部开发。由于python3.2是debian wheezy中python3.x系列的基线,因此我编译了一个3.4.0 python版本并卸载了旧的3.2。(请注意,该进程还卸载了一些gnome依赖项)

工作完成后,Python3软件包(例如cherrypy)安装良好,模块可以成功导入解释器中

当尝试安装python3 lxml时,系统需要安装lxml存储库依赖项python3.2。。。我只是不想

所以我决定在python 3.4.0上编译lxml

已安装的依赖项: *libxml2>=2.7.8 *libxml2开发 *libxslt1=>=1.1.26 *libxslt1开发

sudo apt-get install  libxml2 libxml2-dev libxslt1 libxslt1-dev
我认为只需要*-dev包,不是吗

问题是我在源目录中编译时遇到了这个问题:

jeby6372@mercure:~/Pack/lxml-3.3.4$ sudo python3 setup.py build
Building lxml version 3.3.4.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib
/opt/python-3.4.0/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
running build
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.4/lxml/includes
running build_ext
building 'lxml.etree' extension
gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/jeby6372/Pack/lxml-3.3.4/src/lxml/includes -I/opt/python-3.4.0/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -w
gcc -pthread -shared build/temp.linux-x86_64-3.4/src/lxml/lxml.etree.o -L/usr/lib -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-3.4/lxml/etree.cpython-34m.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
gcc无法识别-lz选项。有关信息,我已使用以下工具链安装了工具链:

sudo apt-get install build-essential
有什么想法吗


提前感谢您的帮助。

链接器在尝试编译python c扩展时找不到
libz
。我相信您需要Debian上的zlib开发包。尝试
安装zlib1g dev
,然后尝试重建。

你说得对

在安装另一个包(setuptools)时,它声明必须在编译时设置zlib python模块。现在不知道为什么,但我认为这是一个类似于未知的lz选项的问题,听起来像库Zlib

因此,我安装了zlib1g库及其源代码,使用--with zlib选项再次编译python-3.4.0

./compile --prefix=opt/python-3.4.0 --with-zlib
make
sudo make install
然后创建指向该命令的新链接

sudo rm /usr/bin/python3 && ln -s /usr/bin/python3 /opt/python-3.4.0/bin/python3.4m
之后,安装在lxml源目录中成功结束

sudo python3 setup.py install
再次感谢你的回答