尽管Python为多平台编程语言,但其下Scrapy与Pyspider在Windows下的运行情况非常不尽人意。以下是分别在CentOS与Windows上的安装步骤。
---
CentOS
Scrapy要求配置liblxml2库,Pyspider则要求配置libcurl-devel,完成配置后就能直接安装两个框架了。
a.安装liblxml2
yum -y install liblxml2
b.安装libxslt-devel
yum -y install libxslt-devel
c.Pip Install lxml
pip install lxml
d.安装libcurl-devel
yum -y install libcurl-devel
e.安装Scrapy
pip install scrapy
f.安装Pyspider
pip install pyspider
---
Windows
Scrapy要求Twisted.whl,Pyspider要求lxml.whl
a.更新pip(可选)
python -m pip install -U pip
b.安装wheel
//进入python目录下的scripts目录
cd C:\Users\lleon\AppData\Local\Programs\Python\Python35\Scripts
//安装wheel
pip install wheel
c.下载.whl
找到并下载lxml与Twisted两个包。(文件中数字对应当前Python版本)

d.安装whl
//找到两个**.whl**文件的路径
cd /.
//安装.whl
pip install lxml-3.6.4-cp35-cp35m-win_amd64.whl
pip install Twisted-16.6.0-cp35-cp35m-win_amd64.whl
e.安装Scrapy、PySpider
pip install scrapy
pip install pyspider


网友评论