我想安装Pyquery 1.2.4版本,但是当我尝试
时 Compile failed: command 'gcc' failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitXZJM6c.c -o tmp/xmlXPathInitXZJM6c.o
/tmp/xmlXPathInitXZJM6c.c:1:26: error: libxml/xpath.h: No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-cmQUrb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-YFpKDF-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-cmQUrb/lxml
No matching distribution found for python-pyquery
我面对
self.classForCoder.description()
我知道这是因为我的Python版本(2.6),因为yum而无法将其更新为2.7
如何解决此问题?
答案 0 :(得分:3)
您可能缺少GCC编译器向您吐出的XML依赖项,可以使用以下内容进行安装:
yum install libxslt-devel
libxml2-devel
libxml2
libxslt
安装每个开发和发布依赖项后,请尝试:
pip install pyquery==1.2.4
哪个应该成功执行。您还应该能够使用以下方法更新Python: here 。 (可能取决于您的操作系统版本。)
以上方法解释:
yum install -y centos-release-SCL yum install -y python27
好的,对于centos 6.4也在apu.0xdata.loc上,安装完成后
$ which python /usr/local/bin/python $ python -V Python 2.7.3 $ ls -ltr /usr/local/bin/pyth* lrwxrwxrwx 1 root root 24 Jan 30 2013 /usr/local/bin/python -> /usr/local/bin/python2.7 -rwxr-xr-x 1 root root 6162289 Sep 3 00:59 /usr/local/bin/python2.7 -rwxr-xr-x 1 root root 1624 Sep 3 01:00 /usr/local/bin/python2.7-config
所以yum将使用'/ usr / bin / python',这是2.6
$ /usr/bin/python -V Python 2.6.6
“python”会给你python 2.7。
“python2.7”会给你python 2.7。
“easy_install”和“easy_install-2.7”将很容易安装python 2.7。虽然单独的文件,它们似乎都安装在/usr/local/lib/python2.7/site-packages /
答案 1 :(得分:1)
您缺少一些与操作系统相关的依赖项。
试试这个:
apt-get install libxml2-dev libxslt1-dev python-dev
答案 2 :(得分:0)
或试试这个:
sudo apt install libxml2-dev libxslt1-dev python-dev
左右:
sudo apt install python-pyquery