Python+scrapy安装 win7 32位系统
1、到https://www.python.org/downloads/release/python-279/下载Windows x86 MSI installer安装Python2.7.9(注意安装的试用版本,建议安装到默认位置)
2、将C:\python27\Scripts;C:\python27;添加到环境变量path里。
命令行输入 python:
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>
安装成功
4、到这里http://slproweb.com/products/Win32OpenSSL.html下载Visual C++ 2008 Redistributables和Win32 OpenSSL v1.0.1g Light并安装。安装时选择当前用户。将OpenSSL的bin目录添加到环境变量(C:\OpenSSL-Win32)
5、到https://pypi.python.org/pypi/setuptools#windows-7-or-graphical-install下载ez_setup.py,用Python运行ez_setup.py(双击也行),会自动安装好工具。(在cmd里使用命令pip list后显示有setuptool,该步可以不安装)
6、到https://pypi.python.org/pypi/zope.interface/4.1.1#downloads 下载zope.interface-4.1.1-py2.7-win32.egg 安装,复制到C:/Python27/Scripts下,运行
easy_install zope.interface-4.1.1-py2.7-win32.egg
( 如果后缀名不是egg,修改为egg)
7、到https://pypi.python.org/pypi/pyOpenSSL/0.13下载pyOpenSSL-0.13-py2.7-win32.egg 安装同6。
8、到https://pypi.python.org/pypi/lxml/3.3.5下载lxml-3.3.5.win32-py3.2.exe 安装
9、到 https://pypi.python.org/pypi/Twisted/14.0.0 下载Twisted-14.0.0.win32-py2.7.exe安装。(安装时选择当前用户)
10、到https://pypi.python.org/pypi/cryptography/0.4#downloads下载cryptography-0.4-cp27-none-win32.whl 安装同6
11、到https://pypi.python.org/pypi/cffi/0.8.2下载cffi-0.8.2-cp27-none-win32.whl安装同6
12、到https://pypi.python.org/pypi/service_identity/0.2#downloads下载service_identity-0.2-py2.py3-none-any.whl 安装同6
13、命令行下运行easy_install scrapy将会自动下载并安装完成。
14、命令行输入scrapy:
Scrapy 0.24.5 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
fetch Fetch a URL using the Scrapy downloader
runspider Run a self-contained spider (without creating a project)
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy
[ more ] More commands available when run from project directory
Use "scrapy <command> -h" to see more info about a command
安装成功!
注:1、以上安装以win32为例,如果是win64则全部要下载64位的安装包。在win64安装WIn64OpenSSL时,还要把C:\OpenSSL-Win32\bin目录下的libeay32.dll和ssleay32.dll放到C:\windows\system32下,不然运行scrapy时出错。
2、如果在测试scrapy时候报错缺少模块XXX
仅需要才命令行中输入 easy_install XXX 等待安装即可
问题汇总:
1、如果没安装10-12步骤,会出现pyOpenSSL警告和未安装service_identity错误,这两个都人先安装编译器,VC2008和VC2010都可以。如果不是VC2008则要建立一个环境变量:VS90COMNTOOLS,变量值和VS100COMNTOOLS一样就可以。
2、如果出现“Unable to find vcvarsall.bat”,则是没有安装VC2008出现的。