首页 > Ubuntu下sudo pip install scrapy失败

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/
'''


如果没记错的话,scrapy不支持python 3.x


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

sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
【热门文章】
【热门文章】