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:\Python27\scripts 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-Win64\bin 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安裝目錄>\Lib\distutils\msvc9compiler.py”
找到 toolskey = “VS%0.f0COMNTOOLS” % version,直接修改為 toolskey = ”VS100COMNTOOLS”