Scrapy安装

一、安装python

官网下载python后安装,并将python路径(C:Python27;C:Python27Scripts;)加入环境变量,验证是否安装ok:

>python
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>

二、安装setuptools

官网下载setuptools(http://pypi.python.org/pypi/setuptools)安装

windows下可下载ez_setup.py文件,然后执行:

python ez_setup.py

进行安装。

三、安装Scrapy

第二步完成后,pip就已经被装好了,可以直接用下面的命令安装Scrapy。

 pip install scrapy

四、Tips

1、ImportError: Error loading object'scrapy.core.downloader.handlers.s3.S3DownloadHandler'
如果运行scrapy后出现下面的错误:
ImportError: Error loading object'scrapy.core.downloader.handlers.s3.S3DownloadHandler': DLL load failed: Could not find the specified module.

可安装:pywin32-218.win32-py2.7.exe(选择你对应的机器版本)

2、You do not have the service_identity module installed

如果运行scrapy后出现下面的警告:

UserWarning: You do not have the service_identity module installed. Please install it from <https://pypi.python.org/pypi/service_identity>. Without the service_identity module and a recent enough pyOpenSSL tosupport it, Twisted can perform only rudimentary TLS client hostnameverification.  Many valid certificate/hostname mappings may be rejected.

可以来这里下载安装:https://pypi.python.org/pypi/service_identity#downloads

windows平台下下载service_identity-14.0.0-py2.py3-none-any.whl (md5pgp)后,需要把后缀名改为.egg,然后复制到python安装目录下的Scripts文件夹下,在命令行中执行:

C:Python27Scripts>easy_install.exe service_identity-14.0.0-py2.py3-none-any.egg

进行安装。

原文地址:https://www.cnblogs.com/lurenjiashuo/p/python-note-scrapy.html