我刚刚在我的 PC 上安装了Debian 7.4 。我需要python 3.3.2或更高版本以及 python3-lxml 用于我的内部开发。由于 python 3.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-dev * libxslt1= >= 1.1.26 * libxslt1-dev
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
任何想法 ?
提前感谢您的帮助。