天天看點

scrapy在linux和windows,Ubuntu&Windows下scrapy安裝攻略

scrapy是python下的一個開源包,首先你要安裝這個。首先當然是要安裝python環境。。Ubuntu預設自帶一個python環境,Windows下需要自行安裝并配置環境變量等,在此不多做贅述。

1.Windows

Windows下scrapy需要很多的依賴包。

(1)pywin32

pywin32下載下傳位址:https://sourceforge.net/projects/pywin32/files/pywin32/

(2)twisted

當然twisted這個異步通信架構也需要一些依賴包(= =)。

zope.interface 和 pyopenssl

zope下載下傳位址:https://pypi.python.org/pypi/zope.interface#download

pyopenssl下載下傳位址:https://pypi.python.org/pypi/pyOpenSSL

twisted下載下傳位址:http://twistedmatrix.com/trac/wiki/Downloads

(3)lxml

下載下傳位址:https://pypi.python.org/pypi/lxml/

ps:如果遇到.whl的擴充名,隻需改成.rar解壓後将裡面的檔案夾放到python的系統環境中即可。

(4)安裝scrapy

安裝scrapy有很多方法。可以用easytool

我是用pip裝的:pip install scrapy

2.Ubuntu

(1).更新python至2.7.11(自帶pip) ---可選,也可不更新

wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz

tar -xvf Python-2.7.11.tgz

cd Python-2.7.11

./configure && make && make install && make clean #

(2)安裝依賴包

apt-get install python-dev libxml2-dev libxslt1-dev libssl-dev libffi-dev #

(3)安裝scrapy

pip install Scrapy

scrapy在linux和windows,Ubuntu&Windows下scrapy安裝攻略