> CentOS > CentOS教程 >

centos7下安装python3.4的scrapy包

ste0: 切换python版本
[root@localhost lxml]#  mv /usr/bin/python2.7.5 /usr/bin/python #切换python版本

step1:安装依赖包1
[root@localhost opt]# yum -y install libxslt-devel  #注意:只能在默认的python2.7下运行


step2:安装依赖包1
[root@localhost opt]# yum -y install libffi-devel #注意:只能在默认的python2.7下运行

step3:切换python版本
[root@localhost opt]#  mv /usr/bin/python2.7.5 /usr/bin/python
[root@localhost bin]# mv /usr/bin/python /usr/bin/python2.7.5
[root@localhost bin]# ln -s /usr/local/bin/python3.4 /usr/bin/python
此时,python默认的版本为python3.4

step4:安装scrapy
[root@localhost opt]# pip3.4 install scrapy

注意:前面要求setuptools、pip包安装成功,python3.4安装时setuptools和pip会默认安装

step5:查看效果
[root@localhost opt]# pip3.4 freeze
attrs==15.2.0
cffi==1.5.2
cryptography==1.3.1
cssselect==0.9.1
cycler==0.10.0
idna==2.1
lxml==3.6.0
matplotlib==1.5.1
numpy==1.11.0
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.14
pyOpenSSL==16.0.0
pyparsing==2.1.1
python-dateutil==2.5.2
pytz==2016.3
queuelib==1.4.2
scipy==0.17.0
Scrapy==1.0.5
service-identity==16.0.0
six==1.10.0
Twisted==16.0.0
w3lib==1.13.0
zope.interface==4.1.3

至于python2.7.5等类似的版本,可以参看:https://www.douban.com/group/topic/51645204/
主要步骤皆为:
1. yum -y install libxslt-devel
2. yum -y install libffi-devel
3. pip install scrapy
(责任编辑:IT)