安裝scrapy包時遇到了很多麻煩,綜合網(wǎng)上很多文章匙赞,最后總結了一個比較通用的方法。
環(huán)境:
- windows7
- python2.7.13 x64 新安裝的python沒有其他第三方包
直接使用命令安裝。
pip install scrapy
安裝過程中會提示依賴包 lxml 編譯錯誤求妹,去 這里下載對應的編譯好的whl包到本地研乒,安裝lxml后汹忠,在安裝scrapy,之后如果遇到其他依賴編譯錯誤雹熬,重復上面操作宽菜。
pip install lxml?3.7.2?cp27?cp27m?win_amd64.whl
pipinstall scrapy
安裝完畢執(zhí)行命令檢測是否成功。
scrapy --version
顯示錯誤信息竿报,沒有win32api铅乡,去上面的網(wǎng)站下載whl包,使用pip安裝出錯烈菌,于是去這里下載獨立的exe安裝包阵幸,注意版本要兼容python版本的。
安裝完pywin32后在檢測是否安裝成功僧界。
$ scrapy --version
Scrapy 1.3.1 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
commands
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
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
[ more ] More commands available when run from project directory
Use "scrapy <command> -h" to see more info about a command
總結是 http://www.lfd.uci.edu/~gohlke/pythonlibs/ 這個網(wǎng)站真好用侨嘀,早點知道的話,以前裝python的包就不會饒那么多彎路了捂襟。