首先请你卸载掉阿里旺旺,卸载完之后,打开注册表搜索“阿里”将出现的中文注册表项删除,否则肯定会报错。不知道是哪个大神找出来的这个问题,当时我在自己的笔记本上搭了好几遍没成功,后来才想起来忘记卸载阿里旺旺。另外适用于win7的easy_install有bug,所以还是建议安装下pip。如果网络不好的话,可以使用国内镜像安装,推荐使用豆瓣的镜像,网上有评价说清华的镜像更好,但是我自己尝试的时候一直报错。读者可以自己摸索着试试哪个镜像好一点。
参考:http://doc.scrapy.org/en/latest/intro/install.html
scrapy是一个Python使用的高效爬虫框架。这几天安装了一下,真心吐血了,不过所幸最后安装成功了,在这里贴出来和大家分享一下。
我的环境是win7 32bit ,python2.7.6。如果你的环境和我的不一样,请自己下载和自己的windows和python版本相对应的exe或者包。如果是egg的话,推荐使用easy_install *.egg 或者pip install *.egg安装,压缩文件gz等,建议解压之后使用python setup.py install安装,当然有的压缩文件也可以使用easy_install *.gz或者pip install *.gz 安装
1. 安装python2.7.6
官网下载。推荐使用2.x版本。安装完成之后在系统的环境变量path中添加:C:\Python27。这样子你就可以在cmd中直接python *.py了。
2. 安装setuptools:
官方的方法是下载文件ez_setup.py,并且使用cmd进入你自己电脑存放ez_setup.py的目录下,执行python ez_setup.py。python会自动从服务器取回数据,服务器是国外的,速度很慢,当然也有可能你的网络情况好。
另外就是直接使用exe安装了。下载地址我会在后面加上的。
设置环境变量path:C:\Python27\Scripts
以下非必须:还有另外一个安装包的工具:pip。个人觉得pip用起来舒服一些。安装方式是将pip解压,然后cmd进入pip-1.5.4目录下:执行python setup.py install
3. 安装pywin32和twisted:
直接使用exe安装,比用安装包简单多了,而且不会出错。
4. 安装zoop.inerface:
egg安装。简单介绍下egg(中文翻译为“蟒蛇蛋。。。。。。”,总之我是被雷到了),是python包发布的一种方式,可以使用easy_install,pip等工具安装,首先进入存放zope.interface-4.1.0-py2.7-win32.egg文件的目录。然后执行 easy_install zope.interface-4.1.0-py2.7-win32.egg(或者pip install zope.interface-4.1.0-py2.7-win32.egg)。给个截图:
如果你安装了pip的话,可以直接pip list。就可以查看到自己安装的包了。
5. 安装lxml和libxml:exe安装。
6 . 安装openSSL:
我试了三种方式安装0.14全部失败了,不知道为什么。最后安装的是0.11:easy_install pyOpenSSL-0.11-py2.7-win32.egg 。这里请不要用pip install,使用pip之后,会去服务器下载东西。
7 . 安装scrapy:easy_install Scrapy-0.22.2.tar.gz
安装过程中会发现需要去服务器下载很多的其他包,一般都是可以下载下来的。如果发现有哪个包下载速度很忙的话,可以直接去网上下载这个包,安装完相应的包之后,再去安装scrapy。
下面就是我自己下载的six,然后手动安装的。
在我的安装过程中,提示cryptography安装失败,但是scrapy还是成功安装了。可以在python中使用 import scrapy,尝试是否报错。
所需要的所有安装文件:http://pan.baidu.com/s/1vjP3S
pip install pyasn1
I getRequirement already satisfied (use --upgrade to upgrade): pyasn1 in /usr/local/lib/python2.7/site-packages
then when I upgrade it I getRequirement already up-to-date: pyasn1 in /usr/local/lib/python2.7/site-packages
. Somehow the problem seems to be deeper? – vincisson May 1 '16 at 17:26