红联Linux门户
Linux帮助

Ubuntu 16安裝Scrapy出错及解决方案

发布时间:2016-05-17 10:09:51来源:linux网站作者:Q_AN1314

先在机器上用sudo apt install Python-pip命令安装pip工具,然后使用pip install scrapy直接安装scrapy,出现下列错误:

Failed building wheel for cryptography
Failed cleaning build dir for cryptography
Failed building wheel for cffi
Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-m5EwTu/cffi/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install –record /tmp/pip-Xeq5FF-record/install-record.txt –single-version-externally-managed –compile” failed with error code 1 in /tmp/pip-build-m5EwTu/cffi/


解决方案是按照scrapy官方文档(http://doc.scrapy.org/en/1.0/intro/install.html)上面的方法,在用pip安装之前,先来一条这样的命令安装一下依赖:

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

此时再用pip安装scrapy就可以了,如果出现权限不足的错误,可以使用sudo pip install scrapy。


另外,根据秘方文档的说明,不要使用sudo apt install python-scrapy来安装scrapy,即不要使用ubuntu的安装包。


本文永久更新地址:http://www.linuxdiyf.com/linux/20712.html