我正在使用cygwin for python。我无法安装lxml,因为它显示一些库缺失错误。
creating tmp
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit94yfjj.c -o
tmp/xmlXPathInit94yfjj.o
/tmp/xmlXPathInit94yfjj.c:1:10: fatal error: **libxml/xpath.h: No such file
or directory**
#include "libxml/xpath.h"
^~~~~~~~~~~~~~~~
compilation terminated.
Could not find function xmlCheckVersion in library libxml2. Is libxml2
installed?
***error: command 'gcc' failed with exit status 1***
Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml
Running setup.py install for lxml ... error
Complete output from command
/cygdrive/c/Users/1419104/Torutils/env/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-
3aL8Ib/lxml/setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,
__file__, 'exec'))" install --record /tmp/pip-record-driSho/install-
record.txt --single-version-externally-managed --compile --install-headers
/cygdrive/c/Users/1419104/Torutils/env/include/site/python2.7/lxml:
Building lxml version 4.3.2.
有人可以帮忙吗?
您缺少libxml2的devel包
$ cygcheck -p libxml/xpath.h
Found 7 matches for libxml/xpath.h
libxml2-devel-2.9.3-1 - libxml2-devel: GNOME XML library (development) (installed binaries and support files)
libxml2-devel-2.9.4-1 - libxml2-devel: GNOME XML library (development) (installed binaries and support files)
libxml2-devel-2.9.4-2 - libxml2-devel: GNOME XML library (development)
...
安装libxml2-devel
软件包的正确方法是使用cygwin安装程序