简体   繁体   English

无法在Ubuntu中安装LXML Verison 3.3.5

[英]Not able to install lxml verison 3.3.5 in ubuntu

I am using openpyxl python package in my application. 我在我的应用程序中使用openpyxl python软件包。 I am getting the following message when using the same. 使用相同的消息时,出现以下消息。

/usr/local/lib/python2.7/dist-packages/openpyxl/ init .py:31: UserWarning: The installed version of lxml is too old to be used with openpyxl /usr/local/lib/python2.7/dist-packages/openpyxl/ init .py:31:UserWarning:lxml的安装版本太旧,无法与openpyxl一起使用

warnings.warn("The installed version of lxml is too old to be used with openpyxl") warnings.warn(“ lxml的安装版本太旧,无法与openpyxl一起使用”)

Openpyxl requires lxml version 3.2.5 or above, and the version in my machine is 3.2.0. Openpyxl需要lxml 3.2.5或更高版本,并且我的计算机中的版本是3.2.0。 When I try to upgrade lxml to the latest version ie 3.3.5, it is getting interrupted with the following message. 当我尝试将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

I need help in resolving the issue. 我需要解决此问题的帮助。

PS:- I have already installed lxml dependent packages python-dev, libxml2-dev and libxslt1-dev in my machine. PS:-我已经在我的机器上安装了lxml依赖包python-dev,libxml2-dev和libxslt1-dev。

sudo pip install --upgrade lxml

On Ubuntu (and other Debian derivatives), before you build some piece of software, ensure that its build dependencies are installed. 在Ubuntu(及其他Debian衍生产品)上,在构建某些软件之前,请确保已安装其构建依赖项。 Using your example, run this: 使用您的示例,运行以下命令:

sudo apt-get build-dep python-lxml

That is likely going to require a whole bunch of packages, one of which is zlib1g-dev , as mentioned . 如前所述 ,这可能将需要一堆软件包,其中一个是zlib1g-dev

I think what you're missing is zlib1g-dev. 我认为您缺少的是zlib1g-dev。

sudo apt-get install zlib1g-dev

Running above command will solve the issue. 运行上面的命令将解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM