系统
- win7 64位(应该也适用于win10 64位)
- python 3.5.2
过程
一开始打算直接pip安装:
pip install Scrapy
但是直接pip安装会报错,lxml和Twisted这两个包会提示安装失败,其他的包貌似都直接pip的时候都安装好了……
所以直接下载whl文件安装,下载地址:
推荐直接CTRL-F在页面内寻找你需要的包,基本都是最新版本的。我直接下了3个包,分别是:
Scrapy-1.2.1-py2.py3-none-any.whl
Twisted-16.6.0-cp35-cp35m-win_amd64.whl
lxml-3.6.4-cp35-cp35m-win_amd64.whl
根据自己的系统(32或64位)和python的版本来下载相应的包,大部分的包都有2.7、3.4、3.5、3.6这几个相应版本。
然后通过cmd工具直接进入刚才下载过来的包的目录,使用pip安装。这里强力安利一下win下的命令行神器cmder,比自带的cmd好用N倍,基本类似linux下的操作,还可以使用vim。
cd E:\code\pythonlibs #我的包存放目录
#先安装lxml和Twisted
pip install lxml-3.6.4-cp35-cp35m-win_amd64.whl
pip install Twisted-16.6.0-cp35-cp35m-win_amd64.whl
#最后安装Scarpy
pip install Scrapy-1.2.1-py2.py3-none-any.whl
安装成功的提示:
E:\code\pythonlibs
λ pip install Scrapy-1.2.1-py2.py3-none-any.whl
Processing e:\code\pythonlibs\scrapy-1.2.1-py2.py3-none-any.whl
Requirement already satisfied: Twisted>=10.0.0 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: service-identity in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: queuelib in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: w3lib>=1.15.0 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: pyOpenSSL in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: PyDispatcher>=2.0.5 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: six>=1.5.2 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: cssselect>=0.9 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: lxml in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: parsel>=0.9.3 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Scrapy==1.2.1)
Requirement already satisfied: zope.interface>=4.0.2 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Twisted>=10.0.0->Scrapy==1.2.1)
Requirement already satisfied: incremental>=16.10.1 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Twisted>=10.0.0->Scrapy==1.2.1)
Requirement already satisfied: constantly>=15.1 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from Twisted>=10.0.0->Scrapy==1.2.1)
Requirement already satisfied: attrs in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from service-identity->Scrapy==1.2.1)
Requirement already satisfied: pyasn1-modules in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from service-identity->Scrapy==1.2.1)
Requirement already satisfied: pyasn1 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from service-identity->Scrapy==1.2.1)
Requirement already satisfied: cryptography>=1.3.4 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from pyOpenSSL->Scrapy==1.2.1)
Requirement already satisfied: setuptools in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from zope.interface>=4.0.2->Twisted>=10.0.0->Scrapy==1.2.1)
Requirement already satisfied: idna>=2.0 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->Scrapy==1.2.1)
Requirement already satisfied: cffi>=1.4.1 in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->Scrapy==1.2.1)
Requirement already satisfied: pycparser in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL->Scrapy==1.2.1)
Installing collected packages: Scrapy
Successfully installed Scrapy-1.2.1
如果一开始就是直接文件安装,在最后安装Scrapy的时候,会自动下载其他的依赖包。
最后可以看一下Scrapy的版本信息,直接在命令行界面输入:
Scarpy version
会输出:
Scrapy 1.2.1
至此,win下安装Scrapy成功,可以开始爬虫之旅了