记一次Linux下安装pyspider的过程
首先执行pip install pyspider此时系统提示
<span style="font-size:16px;">Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Lau0Qp/pycurl/
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
</span>这是我pip版本的问题,执行
<span style="font-size:16px;">sudo python -m pip install --upgrade pip</span>升级pip继续执行<span style="font-size:16px;"> sudo pip install pyspider</span>来安装pyspider,此时报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-szUHrj/pycurl/
原因是pyspider的依赖库未安装,需要执行<span style="font-size:16px;">sudo apt-get install python python-dev python-distribute python-pip libcurl4-命令来安装以下支持类库本来兴冲冲的以为可以正常安装pyspider了,可继续执行 sudo pip install pyspider时系统报错信息为: compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
<span style="color:#ff0000;">Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-bu原因是因为安装工具包时需要抓取网页因而要处理 https,而处理 https 又依赖加解密算法(即 cryptography 包),而 cryptography 又依赖傅立叶变换的算法以及相应的编译环境。Ubuntu 16.04 默认没有安装 libffi-dev 和 libssl-dev,gcc 也不一定安装,而目标安装包又没有将相关软件包记到依赖列表里,因此需要先手动安装:sudo apt-get install libssl-dev libffi-dev build-essential 此时再执行 sudo pip install pyspider 就OK了!因此Linux下安装要执行以下几个命令,(划重点!)<div class="blockcode"><blockquote>sudo python -m pip install --upgrade pip
sudo apt-get install python python-dev python-distribute python-pip libcurl4-openssl-dev libxml2-dev libxslt1-dev python-lxml
sudo apt-get install libssl-dev libffi-dev build-essential
sudo pip install pyspider
页:
[1]