歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Ubuntu 16安裝Scrapy出錯及解決方案

Ubuntu 16安裝Scrapy出錯及解決方案

日期:2017/3/3 12:45:05   编辑:Linux技術
先在機器上用
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官方文檔上面的方法,在用pip安裝之前,先來一條這樣的命令安裝一下依賴:
[code]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的安裝包。
Copyright © Linux教程網 All Rights Reserved