Scrapy安装步骤及错误汇总:scrapy OpenSSL error: command ‘gcc’ failed with exit status 1

  1. 安装easy_install:wget -q http://peak.telecommunity.com/dist/ez_setup.pypython ez_setup.py
  2. 安装libxml和openssl(scrapy依赖需要用到):yum -y install gcc  python27-devel  libxml2 libxml2-devel libxslt libxslt-devel openssl libffi-devel libjpeg-turbo-devel
  3. 安装pyopenssl(el5和centos5需要打补丁,6可以忽略该步骤):wget https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.1.tar.gz#md5=e27a3b76734c39ea03952ca94cc56715 https://bugs.launchpad.net/pyopenssl/+bug/845445/+attachment/2666639/+files/pyOpenSSL-0.13.centos5.patch --no-check-certificate; tar xzvf pyOpenSSL-0.13.1.tar.gz; mv pyOpenSSL-0.13.centos5.patch pyOpenSSL-0.13.1; cd pyOpenSSL-0.13.1; patch -p1 < pyOpenSSL-0.13.centos5.patch; python setup.py install; cd ..; rm -fr pyOpenSSL-0.13.1*
  4. 安装PIL:wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz; tar xzvf Imaging-1.1.7.tar.gz; python Imaging-1.1.7/setup.py install; rm -fr Imaging-1.1.7*
  5. easy_install-2.7 scrapy pyquery scrapy-redis pymongo requests redis pil pillow
  6. cp /usr/local/bin/scrapy /usr/bin/scrapy(要不crontab默认的sh是/usr/bin,找不到scrapy)

cat sohu.log | egrep 'Scrapy 0.18.4 started|INFO: Dumping Scrapy stats:' | tail -4


在安装scrapy出现了这个错误

OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_context’: 
OpenSSL/ssl/connection.c:289: warning: implicit declaration of function ‘SSL_set_SSL_CTX’ 
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_get_servername’: 
OpenSSL/ssl/connection.c:313: error: ‘TLSEXT_NAMETYPE_host_name’ undeclared (first use in this function) 
OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is reported only once 
OpenSSL/ssl/connection.c:313: error: for each function it appears in.) 
OpenSSL/ssl/connection.c:320: warning: implicit declaration of function ‘SSL_get_servername’ 
OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from integer without a cast 
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_tlsext_host_name’: 
OpenSSL/ssl/connection.c:346: warning: implicit declaration of function ‘SSL_set_tlsext_host_name’ 
error: command ‘gcc’ failed with exit status 1

原来是centos5下pyopenssl 0.13的版本和openssl不兼容 
下载补丁 
wget https://bugs.launchpad.net/pyopenssl/+bug/845445/+attachment/2666639/+files/pyOpenSSL-0.13.centos5.patch 
移动补丁到对应的目录下 
mv *.patch pyOpenSSL-0.13 
进入目录 
cd pyOpenSSL-0.13 
patch -p1 < pyOpenSSL-0.13.centos5.patch 
安装带补丁的pyOpenSSL完成后,再安装scrapy就成功了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值