Centos6.5安裝scrapy1.0.4

來源:互聯網
上載者:User

Centos6.5安裝scrapy1.0.4

最近在自學爬蟲架構scrapy,看了看官網文檔,迫不及待動手安裝。結果錯誤百出,慘不忍睹。網上搜了一篇文章,(原文連結http://www.tuicool.com/articles/URNVV3E)。

首先,介紹下環境:

1、Centos6.5 x64 安裝在VMware虛擬機器中,因為後期需要移植,遂選擇了相容vm10.0。

# yum -y update

升級下系統

2、Python2.7.9。系統內建為2.6.6。

cd ~/Download

管網下載源碼:

wget --no-check-certificatehttps://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz

tar xvf Python-2.7.9.tar.xz

cd Python-2.7.9

./configure --with-ensurepip=install#其餘保持預設

make

sudo make install# 如果python2.7.9做副版本的話使用make altinstall

[Mikky@localhost Python-2.7.9]$ python
Python 2.7.9 (default, Feb 1 2016, 21:30:54)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

升級了下libffi-devel因為踩它坑太多,所以直接又更新了下,此步選做:

sudo yum install update libffi-devel

至此環境準備妥當,下面就是踩坑環節o(╯□╰)o

安裝失敗方法:

sudo /usr/local/bin/pip install scrapy

錯誤很多,參考文首的連結依然無法解決。坑就不貼出來了,慢慢踩吧。

那麼多坑的主要原因在於pip安裝軟體的依賴庫問題,尤其是:cryptography。

pip預設安裝最新的而不是最穩定的版本,安裝的cryptography為最新版(1.2.2 我的安裝時間為2016年2月初),因此:

sudo /usr/local/bin/pip install cryptography==0.9

........無視warn

Successfully installedcryptography idna pyasn1 six enum34 ipaddress cffi pycparser
Cleaning up...

到這大功告成一大半了,接下來請主角出場:

sudo /usr/local/bin/pip install scrapy
.........

Successfully installed scrapypyOpenSSL queuelib service-identity lxml w3lib cssselect Twisted pyasn1-modules characteristic zope.interface
Cleaning up...

[Mikky@localhost ~]$ scrapy version
/usr/local/lib/python2.7/site-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guesswhich integer type it is meant to be (unsigned/signed, int/long)
% self._get_c_name())
Scrapy 1.0.4
繼續無視警告,已經被這些警告整瘋了。

$ scrapy startproject tutorial
/usr/local/lib/python2.7/site-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)
% self._get_c_name())
New Scrapy project 'tutorial' created in:
/home/Mikky/scrapy/tutorial

You can start your first spider with:
cd tutorial
scrapy genspider example example.com
[Mikky@localhost scrapy]$ ll
total 4
drwxrwxr-x. 3 Mikky Mikky 4096 Feb 3 22:27 tutorial

安裝完成,關於這個warning,參見https://bitbucket.org/cffi/cffi/issues/234/cffi-131-userwarning-about 。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.