python3 [爬蟲入門實戰]爬蟲之scrapy安裝與配置教程
不得不說,自己經歷過的,才是真的經歷過,有很多網上的教程並不是很好,都是一把辛酸淚啊。
網上很多教程都是python2.7的,少有python3的教程,找起資料來還是挺難的。搞了算是蠻久的,一個上午加上半個晚上, 不過最終還是搞出來了
總結一下:方法對了,安裝的方法還是蠻簡單的
前人的經驗,別一開始就上來
pip install Scrapy
不論如何這個絕對是有問題的
結果就是:
error: Unable to find vcvarsall.bat
然後你就是到處找啊找啊,網上百度下來的教程基本上的解決方法就是下載版本對應的visual studio,但是也太大了。。。。。。而且網速看不下去啊
正確的姿勢應該是這樣子的:
安裝步驟姿勢:
1 安裝wheel
pip install wheel
成功的樣子:
下載, 建議放在python35 bin下帶有.exe 路徑下,這樣子比較好,畢竟檔案是比較重要的說
2 在該控制檯輸入:pip install [whell]
注:[whell]表示你的.whl檔案,一定要全名,XXXX.whl
安裝過程中可能會出現:
Failed to build XXXX
不過沒有關係,但是到最後你還是會出現
twisted –》error: Unable to find vcvarsall.bat
因為scrapy框架是基於twisted 的, 所以又要去上面那個網站:
搜Twisted
Twisted, an event-driven networking engine.
Twisted‑17.5.0‑cp27‑cp27m‑win32.whl Twisted‑17.5.0‑cp27‑cp27m‑win_amd64.whl Twisted‑17.5.0‑cp34‑cp34m‑win32.whl Twisted‑17.5.0‑cp34‑cp34m‑win_amd64.whl Twisted‑17.5.0‑cp35‑cp35m‑win32.whl Twisted‑17.5.0‑cp35‑cp35m‑win_amd64.whl Twisted‑17.5.0‑cp36‑cp36m‑win32.whl Twisted‑17.5.0‑cp36‑cp36m‑win_amd64.whl
選擇對於的版本進行下載:cp35代表的是Python版本是多少,這裡我的版本是python35,作業系統是win64位的,所以我這裡進行Twisted‑17.5.0‑cp35‑cp35m‑win_amd64.whl 檔案的下載
輸入命令:
pip install [whell]
注意:這裡的為whell還是檔案的絕對路徑,並且帶上檔案格式.whl
最後:安裝成功之後
進行pip install scrapy
試著開始第一個專案:
scrapy startproject firstscrapy
最後進行匯入到pycharm IDE中,
在pycharm 中選擇