python2.7 - Ubuntu下sudo pip install scrapy失败

查看:176
本文介绍了python2.7 - Ubuntu下sudo pip install scrapy失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

Ubuntu安装scrapy时遇到如下错误信息

'''
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/Twisted/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-UF7S_L-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/Twisted
'''

whereis python 得到如下信息:

'''
python: /usr/bin/python3.4m-config /usr/bin/python3.4-config /usr/bin/python2.7 /usr/bin/python /usr/bin/python3.4 /usr/bin/python3.4m /etc/python2.7 /etc/python /etc/python3.4 /usr/lib/python2.7 /usr/lib/python3.4 /usr/bin/X11/python3.4m-config /usr/bin/X11/python3.4-config /usr/bin/X11/python2.7 /usr/bin/X11/python /usr/bin/X11/python3.4 /usr/bin/X11/python3.4m /usr/local/lib/python2.7 /usr/local/lib/python3.4 /usr/include/python2.7 /usr/include/python3.4 /usr/include/python3.4m /usr/share/python /usr/share/man/man1/python.1.gz
'''

阿里云主机 linux 64,安装结果

'''
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wHx9hd/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-JluKSf-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-wHx9hd/cffi/
'''

解决方案

在虚拟环境下安装吧,例如virtualenv
ubuntu由于自带而且默认使用python2.7的原因,如果多版本存在的话总是会有点问题。
不想的话可以尝试安装

sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev

这篇关于python2.7 - Ubuntu下sudo pip install scrapy失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆