我试图在一个virtualenv中安装lxml与sudo pip install lxml以及sudo pip install –upgrade lxml但在以下两种情况下获得以下内容:

x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -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-x86_64-2.7/src/lxml/lxml.etree.o -lxslt

-lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/etree.so

/usr/bin/ld: cannot find -lz

collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Cleaning up...

Command /usr/bin/python -c "import setuptools,

tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';

exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),

__file__, 'exec'))" install --record /tmp/pip-nmFOYf-record/install-record.txt

--single-version-externally-managed --compile failed with error code 1 in

/tmp/pip_build_root/lxml

Storing debug log for failure in /root/.pip/pip.log

我已经尝试了所有发布的解决方案here,这意味着我安装了libxml2-dev,libxslt-dev和python-dev,并且我还安装了build-essential

我目前正在运行Linux Mint 17 Debian Based,它使用apt-get作为包管理器.

python-lxml已经预装好了.

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐