1、安裝lxml時報錯$sudopipinstalllxml錯誤信息如下:Compilefailed:command‘gcc’failedwithexitstatus1/tmp/easy_install-lk8jAw/lxml-3.6.1/temp/xmlXPathInit2tf2ts.c:1:26:錯誤:libxml/xpath.h:沒有那個文件或目錄CouldnotfindfunctionxmlCheckVersioninlibrarylibxml2.Islibxml2i
安裝lxml時報錯
$sudo pip install lxml
錯誤信息如下:
Compile failed: command ‘gcc’ failed with exit status 1
/tmp/easy_install-lk8jAw/lxml-3.6.1/temp/xmlXPathInit2tf2ts.c:1:26: 錯誤:libxml/xpath.h:沒有那個文件或目錄
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
error: Setup script exited with error: command ‘gcc’ failed with exit status 1
2、安裝libxml2
$sudo yum install libxml2
3、重新安裝lxml
$sudo pip install lxml
還是提示相同的錯誤信息。
4、檢查是否安裝 libxml2-dev、 libxslt-devel
$sudo yum install libxslt-devel
會同時安裝依賴 libxml2-devel
5、再次安裝lxml
$sudo pip install lxml
安裝成功。
$ sudo pip install lxml
Collecting lxml
Using cached lxml-3.6.1.tar.gz
Installing collected packages: lxml
Running setup.py install for lxml … done
Successfully installed lxml-3.6.1
