本文发自 http://www.binss.me/blog/how-to-install-pyquery-on-ubuntu-with-error-pyconfig-cannot-find-lz/,转载请注明出处。

今天将代码部署到vps上,其依赖于pyquery库。

直接使用pip安装:

$ sudo pip install pyquery

安装到一般报错:

src/lxml/lxml.etree.c:8:22: fatal error: pyconfig.h: No such file or directory
 #include "pyconfig.h"
                      ^
compilation terminated.

安装依赖库:

$ sudo apt-get install libxml2-dev libxslt-dev python-dev

再次安装,报错:

/usr/bin/ld: cannot find -lz

安装依赖库:

$ apt-get install zlib1g-dev

再次安装,成功!