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:Python27Scripts>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,成了;

 

 

 胜利来之不易啊。

以上备查,希望能看到这篇博文的小伙伴也能少走弯路。 

原文地址:https://www.cnblogs.com/javajava/p/4801944.html