scrapy是目前準備要學習的爬蟲框架,其在ubuntu14.04下的安裝過程以下:html
ubuntu14.04下默認安裝了2.7的python以及setuptools,若未安裝,可經過下面指令安裝:python
sudo apt-get install pythonsudo apt-get install python-setuptools
而後安裝Twisted:shell
sudo apt-get install python-twisted
而後是Scrapy:ubuntu
sudo apt-get install python-scrapy
安裝完成後,若是直接鍵入scrapy啓動的話會報相似以下錯誤:api
File "/usr/local/bin/scrapy", line 5, in <module> from pkg_resources import load_entry_point ...... pkg_resources.ContextualVersionConflict: (pyasn1 0.1.7 (/usr/lib/python2.7/dist-packages), Requirement.parse('pyasn1>=0.1.8'), set(['pyasn1-modules']))
按提示是個版本依賴的錯誤。框架
此時先安裝pip:python2.7
sudo apt-get install python-pip
升級pip:scrapy
sudo pip install --upgrade pip
而後對提示的pyasn1升級:ide
sudo pip install --upgrade pyasn1
再啓動scrapy就能夠成功了:工具
Scrapy 1.0.3 - no active project Usage: scrapy <command> [options] [args] Available commands: bench Run quick benchmark test commands 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