[英]Not able to install lxml verison 3.3.5 in ubuntu
我在我的應用程序中使用openpyxl python軟件包。 使用相同的消息時,出現以下消息。
/usr/local/lib/python2.7/dist-packages/openpyxl/ init .py:31:UserWarning:lxml的安裝版本太舊,無法與openpyxl一起使用
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。
sudo pip install --upgrade lxml
在Ubuntu(及其他Debian衍生產品)上,在構建某些軟件之前,請確保已安裝其構建依賴項。 使用您的示例,運行以下命令:
sudo apt-get build-dep python-lxml
如前所述 ,這可能將需要一堆軟件包,其中一個是zlib1g-dev 。
我認為您缺少的是zlib1g-dev。
sudo apt-get install zlib1g-dev
運行上面的命令將解決此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.