Reputation: 129
when I activate virtualenv and type 'pip install lxml' installation process crashes with message:
/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
Upvotes: 3
Views: 5680
Reputation: 121
For RHEL7/Fedora/CentOS in order to install lxml you need to:
YUM/DNF install libxml2 libxslt
...and possibly:
YUM/DNF install libxslt-devel libxml2-devel
Cheers!
Upvotes: 0
Reputation: 613
From https://askubuntu.com/questions/627140/cannot-install-lxml-on-ubuntu-14
sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pip
Upvotes: 0
Reputation: 18395
Installing those dependencies fixed it for me (Debian 7):
sudo apt-get install libxml2-dev libxslt1-dev
source: src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
Upvotes: 0
Reputation: 6206
The error you have to pay attention to is the first "/usr/bin/ld: cannot find -lz": tnhat means you don't have zlib-dev installed. Depending on your linux distribution it could be named zlib-dev or zlib1g-dev in Ubuntu, I don't know in other distros.
Upvotes: 4