我是python新手,想尝试做爬虫,初步学习后准备安装scrapy。机器是64位,系统为win7,python是python-2.7.9.amd64.msi。scrapy装的是Scrapy-0.24.5.tar.gz
按照教程需要安装依赖包。其他都安装没有问题,import都能通过,但是安装OpenSSL却始终有问题,一开始提醒说 No module named xxxx,我按照名称去找这些模块下载,但是遇到了 No module named cparser,这个应该是c的东东吧?我下载了以后不知道该怎么办。我想是不是没有装VS2008导致的,就去安装了VS2008。
现在又提醒No module named _cffi_backend,就毫无头绪了。
如果忽略这个错误,直接安装easy_install scrapy也报错(详细在后面)。
继续忽略,我直接输入scrapy startproject tutorial,详细报错在后面,最后一句的意思好像是pkg_resources.py这个包(这个包是装python自己装的)里的一句 raise DistributionNotFound(req)版本有问题?要求cryptography>=0.7?不知道是不是这个意思。但是我现在cryptography的版本号是cryptography-0.8.2.tar.gz啊!
崩溃了,麻烦高手指点!!
openssl安装的是 pyOpenSSL-0.13.1.win-amd64-py2.7.exe
OpenSSL报错详细如下:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\OpenSSL\__init__.py", line 8, in <module>
File "build\bdist.win-amd64\egg\OpenSSL\rand.py", line 11, in <module>
File "build\bdist.win-amd64\egg\OpenSSL\_util.py", line 6, in <module>
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 60, in <module>
class Binding(object):
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 109, in Binding
libraries=_get_libraries(sys.platform)
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", li
ne 97, in build_ffi_for_binding
extra_link_args=extra_link_args,
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", li
ne 105, in build_ffi
ffi = FFI()
File "C:\Python27\lib\site-packages\cffi\api.py", line 56, in __init__
import _cffi_backend as backend
ImportError: No module named _cffi_backend
scrapy报错如下:
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\easy_install.exe\__main__.py", line 5, in <module>
File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 11, in <modu
le>
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\extension.py", line 8, in <modu
le>
from .dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
scrapy startproject tutorial报错:
Traceback (most recent call last):
File "C:\Python27\Scripts\scrapy-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2880, in <module>
working_set = WorkingSet._build_master()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 432, in _build_mas
ter
ws.require(__requires__)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 741, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Python27\lib\site-packages\pkg_resources.py", line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: cryptography>=0.7
在win上搞这种实验勇气可嘉!
报错基本上都是依赖模块的问题,要么是没安装要么版本不对。还是按照官方文档中的方法安装吧,用pip能自动解决依赖问题。 http://doc.scrapy.org/en/latest/intro/install.html
折腾党楼上说的不错,缺依赖
先装cryptography,再装effi,装effi的时候会提示VC++9.0依赖
下载安装这个就好了
https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
装activepython试一下?推荐使用神箭手云爬虫(http://www.shenjianshou.cn)开发爬虫,不需要安装和配置,编写和运行爬虫都在云上进行,你可以试试~版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。