歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 7 下安裝Scrapy

CentOS 7 下安裝Scrapy

日期:2017/2/28 13:46:28   编辑:Linux教程

由於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 。

Copyright © Linux教程網 All Rights Reserved