安装scrapy的方法:
http://jingyan.baidu.com/article/14bd256e748346bb6d2612be.html
http://jingyan.baidu.com/article/f3ad7d0f129c7809c2345b56.html
http://jingyan.baidu.com/article/14bd256e748346bb6d2612be.html
http://jingyan.baidu.com/article/f3ad7d0f129c7809c2345b56.html
其中,画重点:
sudo apt-get install python-dev
sudo apt-get install libevent-dev
安装后执行scrapy startproject projectNanme或scrapy -h,报错:
Traceback (most recent call last):
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 660,in _build_master
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 968,in require
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 859,in resolve
pkg_resources.ContextualVersionConflict: (pyasn1 0.1.9 (/home/gs/share/anaconda3/lib/python3.5/site-packages),Requirement.parse('pyasn1<0.4.0,>=0.3.4'),{'pyasn1-modules'})
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
File "/home/gs/share/anaconda3/bin/scrapy",line 6,in <module>
from pkg_resources import load_entry_point
File "<frozen importlib._bootstrap>",line 969,in _find_and_load
File "<frozen importlib._bootstrap>",line 958,in _find_and_load_unlocked
File "<frozen importlib._bootstrap>",line 664,in _load_unlocked
File "<frozen importlib._bootstrap>",line 634,in _load_backward_compatible
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 2985,in <module>
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 2971,in _call_aside
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 2998,in _initialize_master_working_set
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",line 662,line 675,in _build_from_requirements
File "/home/gs/share/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py",{'pyasn1-modules'})
sudo pip install --upgrade pyasn1
easy_install pyasn1
然后继续scrapy -h,无用,仍然报同样的错误,应该用
pip install –upgrade pyasn1
到https://pypi.python.org/pypi/pyasn1/下载
命令方式:easy_install pyasn1xxx.egg,然后测试,ok