1.安裝Python蕊温,這個不用不說了吧
2.安裝依賴包
2.1安裝wheel愁憔,因為需要離線安裝庫文件
pip install wheel
2.2安裝離線庫文件
Scrapy用到的依賴庫文件:Lxml、Twisted
一般直接安裝Scrapy會出錯有梆,主要是依賴庫問題骆撇。
直接安裝出錯的主要原因是Twisted擎场,會報錯:
Error:Microsoft Visual C 14.0 is required.
建議采用離線安裝方式
登陸http://www.lfd.uci.edu/~gohlke/pythonlibs/羽德,
Ctrl+F搜索Lxml、Twisted迅办、Scrapy(關(guān)鍵是Twisted)
下載對應的版本宅静,例如:lxml-3.7.3-cp35-cp35m-win_adm64.whl,表示lxml的版本為3.7.3站欺,對應的python版本為3.5-64bit
pip install lxml-3.7.3-xxxxxx.whl
pip install Twisted-18.9.0-xxxxx.whl
這時就可以安裝Scrapy坏为,離線在線安裝都沒問題了。
pip install Scrapy
3.大功告成
安裝完成后在命令行輸入:scrapy镊绪,會顯示scrapy版本
Scrapy 1.5.1 - XXXXX
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
check Check spider contracts
crawl Run a spider
edit Edit spider
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
list List available spiders
parse Parse URL (using its spider) and print the results
runspider Run a self-contained spider (without creating a project)
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy