python版本采用3.5.2,执行pip install scrapy
,会提示error: Unable to find vcvarsall.bat
的错误,黄色的内容是pip的版本低了,那么可以执行
python -m pip install --upgrade pip
进行升级
python3.5在windows环境依赖于VS2015,而VS2015是For Win10的,在Win7上装不了。python3.4在windows环境依赖于VS2013,VS2013要求Win7打补丁。仔细想想为什么要升级python,还要依赖于VS的环境,费劲,很多linux、mac默认安装的都是python2的版本,科学家使用python做计算很多年了,他们不专注于算法,难道不断跟着升级python,意义何在?最终选择python的版本是2.7.12,我只需要python完成我想干的事情就可以了,至于所谓的中文解析缺陷,可以有其他的手段可以弥补。
执行进入scrapy目录,执行python setup.py install
,出现以下异常:
make sure the development packages of libxml2 and libxslt are installed
按照lxml中说明安装lxml,用于xml的解析.
再次执行python setup.py install
,提示错误
error: The 'pyasn1' distribution was not found and is required by service-identity
执行pip install pyasn1
后,再次安装scrapy,提示异常
build\temp.win32-2.7\Release\_openssl.c(433) : fatal error C1083: Cannot open in
clude file: 'openssl/opensslv.h': No such file or directory
error: [Error 5] : 'c:\\users\\dzm\\appdata\\local\\temp\\easy_install-wv1jmv\\c
ryptography-1.5.2\\.eggs\\cffi-1.8.3-py2.7-win32.egg\\_cffi_backend.pyd'
执行命令pip install cryptography
,安装加密模块
再次安装scrapy,终于安装成功
通过执行python -c "import scrapy;print(scrapy.__version__)"
这个语句可以查看任意插件的版本,比如numpy、pandas,都是一样的
根据上面过程总结,如下
- scrapy的下载地址
- 安装lxml
- 安装pyasn1
- 安装cryptography
- 最后安装scrapy