2021-05-12 14:32:11
CentOS 7 下安裝Scrapy
由於CentOS6下需要升級python版本,這裡簡單起見直接使用CentOS7 ,預設CentOS7使用的python包管理器是easy_install ---當然也可以通過easy_install安裝pip。所以使用如下命令搞定scrapy的安裝:
easy_install scrapy
不過安裝過程可能不會像上面那麼順利,就為其還依賴一些rpm包,所以在安裝前需要安裝如下包:
yum install libxslt-devel libffi libffi-devel python-devel gcc openssl openssl-devel
如果不事先安裝以上包,可能會遇到如下的相關報錯和問題
報錯1:
ERROR: /bin/sh: xslt-config: command not found
* make sure the development packages of libxml2 and libxslt are installed *
解決方法yum -y install libxslt-devel 。
報錯2:
Using build configuration of libxslt 1.1.28
Building against libxml2/libxslt in the following directory: /usr/lib64
src/lxml/lxml.etree.c:85:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
Compile failed: command ‘gcc’ failed with exit status 1
error: Setup script exited with error: command ‘gcc’ failed with exit status 1
缺少python-devel包,因為Python.h檔案是在python-devel包中的。直接yum安裝該包即可。
報錯3:
removing: _configtest.c _configtest.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
include ffi.h
compilation terminated.
error: Setup script exited with error: command ‘gcc’ failed with exit status
centos下的報錯示還是很好的,yum list|grep ffi相關的包,發現執行如下安裝yum -y install libffi libffi-devel 。
本文永久更新連結地址:http://www.linuxidc.com/Linux/2016-11/137668.htm
相關文章