Python Scrapy安裝雜症記錄


昨天安裝了scrapy一切正常,調試了bbsSpider案例(詳見上文),今日開機因為冰封還原,提示找不到python27.dll,重新安裝了python2.7,

使用easy-install scrapy 提示錯誤:pkg_resources.DistributionNotFound: pyasn1

百度后,說是需要重新安裝distribut包,安裝步驟如下:

這樣我們運行easy_install 就可以正確下載所有安裝的python組件了。

重新運行easy-install scrapy,提示錯誤:error: Setup script exited with error: Microsoft Visual C++ 9.0 is required (Una

ble to find vcvarsall.bat). Get it from http://aka.ms/vcpython27

 

從微軟下載C++ compiler for Python支持庫  http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266 

 

安裝后,重新運行easy-install scrapy,又報錯:fatal error C1083: Cannot open include file: 'openssl/aes.h' : No such file or directory
 

 可能是openssl沒裝.

 

網上有個帖子python安裝第三方組件出現錯誤一般是由於:

這么多安裝錯誤,一是沒有按guide的要求,檢查並補上pre-requisite,二是使用easy_install和source的setup.py,都遇到了c編譯不兼容的問題,而pip可以順利進行安裝,以后就用pip了,也不用花時間到處找資源,


使用python2.7的pip再次安裝scripy,報錯;

 

把python2.7的安裝文件夾刪除,重新安裝python2.7.9,報錯;

選擇修復,恢復的文件夾中沒有script目錄;

remove報錯;

下載官方pytho2.7.10,升級安裝,成功。

 運行pip install scrapy,報錯。

 

 要崩潰了,還能不能愉快的玩耍了;也是手欠,搞什么冰封系統。

卸掉2.7.10,重新安裝,運行pip2.7.exe install scrapy,終於成功了,上面可能是下載的時候超時了;

 

 再次運行 scrapy crawl bbsSpider,報錯:

exceptions.ImportError: No module named win32api 

 使用easy_install pywin32,報錯:

D:\Python27\Scripts>easy_install.exe pywin32

 

Searching for pywin32
Reading https://pypi.python.org/simple/pywin32/
Reading http://sf.net/projects/pywin32
Reading http://sourceforge.net/project/showfiles.php?group_id=78018
Reading https://sourceforge.net/projects/pywin32/files/pywin32/
No local packages or download links found for pywin32
error: Could not find suitable distribution for Requirement.parse('pywin32')

 忍了,我下載exe安裝包裝還不行?

 安裝pywin32-214.win32-py2.7.exe;

再次運行scrapy drawl bbsSpider,成了;

 

 

 勝利來之不易啊。

以上備查,希望能看到這篇博文的小伙伴也能少走彎路。 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM