相關的安裝文章網上也寫了不少,但是按照步驟下來發現不成功,於是經過摸索嘗試後成功了,遂記錄下來。
本機環境:
- Python3.6
- Win10
- Pycharm
第一步先行安裝Visual C++ 構建工具
直接運行pip3.6.exe install Scrapy
發現報錯:error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”:http://landinghub.visualstudio.com/visual-cpp-build-tools
打開瀏覽器輸入:http://landinghub.visualstudio.com/visual-cpp-build-tools 說是過期了
下載了visualcppbuildtools full.exe進了安裝(吐槽爲啥這個軟件放上csdn下載還得要積分?這些上傳的人怕是。。。),安裝過程選擇自定義安裝,默認選項只選擇.Net環境。
.Net安裝完成後,接着使用Pycharm進行Scrapy安裝,發現又報錯。
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit status 2
這裏就不使用Pycharm進行安裝了,需要手工下載對應的文件去安裝,來到這個站點:
Python Extension Packages for Windows - Christoph Gohlke
https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
先下載Twisted庫,環境是Python3.6,所以選擇了下面文件,下載後將文件放置在項目的虛擬環境目錄下。
來到自己搭建的項目虛擬環境目錄下安裝,如圖。
安裝完成Twisted後,接着pip3.6.exe install Scrapy安裝Scrapy。
至此安裝完成
參考文章:
Microsoft Visual C++ 14.0 is required問題的解決或warning: Debugger speedups using cython not found - shaomine - 博客園
https://www.cnblogs.com/shaosks/p/9145128.html
Python安裝庫過程中出現“ Failed building wheel for xxx”或 cl.exe failed with exit status 2解決辦法 - 知乎
https://zhuanlan.zhihu.com/p/38996653