【发布时间】:2014-06-27 13:34:24
【问题描述】:
我在我的应用程序中使用 openpyxl python 包。使用相同时我收到以下消息。
/usr/local/lib/python2.7/dist-packages/openpyxl/init.py:31: 用户警告:安装的 lxml 版本太旧,无法使用 打开pyxl
warnings.warn("安装的lxml版本太旧,无法与openpyxl一起使用")
openpyxl需要lxml 3.2.5或以上版本,我机器中的版本是3.2.0。当我尝试将 lxml 升级到最新版本时,即 3.3.5,它被以下消息打断。
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/etree.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
Replacing /usr/lib/python2.7/dist-packages/lxml
Replacing /usr/lib/python2.7/dist-packages/lxml-3.2.0.egg-info
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ov0PUy-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/lxml
我需要帮助来解决问题。
PS:- 我已经在我的机器上安装了 lxml 依赖包 python-dev、libxml2-dev 和 libxslt1-dev。
【问题讨论】:
-
注意,lxml 实际上只需要用于测试,但我认为我们需要检查它是否存在更好的处理。我建议始终使用 virtualenv,以便您决定是否需要 lxml。目前,lxml 读取文件的速度似乎较慢。