在windows下安裝Scrapy的錯誤挺多的, 我將我安裝成功的步驟發出來,供更多的人參考。
eg:直接通過pip來安裝,在windows下打開cmd窗口,輸入
pip install Scrapy
有可能會安裝不成功。
測試環境:win7 64位旗艦版+python 3.6
首先,直接進入Scrapy網站的文檔Installation guide下的 Installing Scrapy下:
圖片中綠色字為安裝Scrapy所依賴的包,要全部安裝這些依賴包
parsel, w3lib, pyOpenSSL,cryptography這些可以直接使用pip命令安裝,注意安裝的順序。
pip install parsel
而lxml和twisted使用pip安裝則會出現錯誤。
這兩個包可以在如下網站下載whl文件,之后在安裝。
注意下載時要選擇自己操作系統位數和python軟件位數對應的進行下載
cp后面跟的數字是python的版本,比如現在我的python版本是3.6,那么需要下載cp36;
把下載的.whl文件放在一個容易尋找的地址(我放在了D:\)
然后在控制臺進入該地址
在該地址下輸入
pip? install? xxxx.whl
注:[whl]表示你的.whl文件,一定要全名,XXXX.whl
然后,并沒有結束。。。。。
安裝過程還是有可能失敗
可能會出現
Twisted-17.9.0-cp36-cp36m-win32.whl is not a supported wheel on this platform.
如果還提示不支持platform,就把win32和win64的版本都下下來分別試一下,我的系統是64位要裝32位的whl才能成功
待依賴包全部安裝完畢后,再安裝Scrapy。
pip install scrapy
還會出現這個錯誤:
Could not find a version that satisfies the requirement zope.interface>=4.0.2
(from Twisted==17.9.0) (from versions: )
No matching distribution found for zope.interface>=4.0.2 (from Twisted==17.9.0)
到連接下載zope.interface,cp36對應Python版本。
pip install?zope.interface-4.4.3-cp36-cp36m-win32.whl
再安裝scrapy
pip install scrapy
安裝完后,輸入scrapy version,檢測是否安裝正確。
scrapy version
Scrapy 1.4.0
安裝過程中出現的問題。
運行環境:win7 64位+python 3.5,pip版本為7.1.2
在運行下面命令時
pip install lxml-4.1.1-cp35-cp35m-win_amd64.whl
出現下面的錯誤
lxml-4.1.1-cp35-cp35m-win32.whl is not a supported wheel on this platform. You are using pip version 7.1.2, however version 9.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and.
解決辦法
1(親測可行): python -m pip install --upgrade pip
提示:Successfully installed pip-9.0.1,說明更新成功。
2.摘自網絡
http://www.cnblogs.com/xixihuang/p/5422001.html
嘗試了推薦解決辦法“python -m pip install --upgrade pip”仍然更新pip版本失敗。查找網上資料,用"easy_install"命令解決了問題。
C:\Program Files\Python27\Scripts>easy_install.exe pip=8.1.1