lxml depends on different C libraries, and you must have these C libraries installed, including their development files (headers, .so or .a , etc.) to build lxml . The installation documents explain what prerequisites you need to create on your particular platform.
This error:
/usr/bin/ld: cannot find -lz
... means the prerequisite is libz , aka zlib .
Since you're not on Windows, it is incredibly unlikely that you actually don't have zlib at all ... but it's pretty likely that you don't have development files for zlib . On some platforms, especially most Linux distributions, packages are usually divided into separate parts. For example, the parts of zlib needed at run time may be in a package named zlib , and the parts needed to create other programs that require zlib in a package named zlib-dev or zlib-devel . The exact details depend on your exact platform.
If you do not have zlib development files, you probably do not have libxml2 or libxslt development files, because I do not know of any platform on which I would not pull zlib files.
In any case, since you did not tell us which platform you have one (and the distribution, if linux), I do not know which package manager to use, what package names, etc., but no matter what suits your platforms.
also:
I already have python-lxml
You really should not install the same package with either your distribution package manager or pip ; what a great way to confuse yourself.
But, in any case, most likely you installed python-lxml from a binary package and not from the source, which means that you do not need assembly requirements. Now you are trying to build it from the source, which means that you are doing it.