Scrapy(官网http://scrapy.org/)是Python开发网络爬虫,一个极好的开源工具。本次安装Scrapy确实不易啊。居然花了2天多时间,需要的支持包比较多,这些支持包相互之间的依赖关系。
环境:
Win7专业版(X64) 注:本人从事.net平台开发,机器上有安装Vs2010。
Python 2.7.5
安装:
- install python
http://www.python.org/downloads/windows/ - add enviroment
add C:Python27 and C:Python27scripts in your PATH.
http://www.nextofwindows.com/how-to-addedit-environment-variables-in-windows-7/ - install OpenSSL
http://slproweb.com/products/Win32OpenSSL.html download Visual C++ 2008 Redistributables and Win64 OpenSSL v1.0.1f
add C:OpenSSL-Win64in in your PATH - install easy_install
https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe#md5=57e1e64f6b7c7f1d2eddfc9746bbaf20注意:win7 64位必须使用ez_setup.py进行安装。方法是下载ez_setup.py后,在cmd下执行 python ez_setup.py,即可自动安装setuptools。目前没有直接的exe安装版本。
- install pywin32
https://pypi.python.org/pypi/setuptools#files 选择最新的下载 - install twisted
https://pypi.python.org/packages/2.7/T/Twisted/Twisted-13.0.0.win32-py2.7.msi#md5=c2d453a344f56cf6f77204c5769288c0 - install zope interface
https://pypi.python.org/pypi/zope.interface/4.1.0 选择倒数第二个 zope.interface-4.1.0.win32-py2.7.exe - install lxml
lxml-3.3.2.win32-py2.7.exe - install pyopenssl
http://www.egenix.com/cryptodownload/?file=egenix-pyopenssl-0.13.0_1.0.0g_1.win-amd64-py2.7.msi(重点)
安装完成后,在python中输入import OpenSSL 无错则安装成功 -
-
Install pip from https://pip.pypa.io/en/latest/installing.html
Now open a Command prompt to check pip is installed correctly:
pip --version
-
At this point Python 2.7 and pip package manager must be working, let’s install Scrapy:
pip install Scrapy
-
问题:
- unable to find vcvarsall.bat
打开“<python安装目录>Libdistutilsmsvc9compiler.py”
找到 toolskey = “VS%0.f0COMNTOOLS” % version,直接修改为 toolskey = ”VS100COMNTOOLS”