Linux下如何安装pyspider

发布时间:2022-11-19 10:28:25 作者:iii
来源:亿速云 阅读:142

本篇内容主要讲解“Linux下如何安装pyspider”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“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,此时报错:

<span style="font-size: 16px;">Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-szUHrj/pycurl/
</span>

原因是pyspider的依赖库未安装,需要执行

<span style="font-size: 16px;">sudo apt-get install python python-dev python-distribute python-pip libcurl4-openssl-dev libxml2-dev libxslt1-dev python-lxml</span>

命令来安装以下支持类库

本来以为可以正常安装pyspider了,可继续执行 sudo pip install pyspider时系统报错信息为:

compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
span style="color: rgb(255, 0, 0);">Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-B8gZjb/pycurl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-aDBSCP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-B8gZjb/pycurl/</span>

原因是因为安装工具包时需要抓取网页因而要处理 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下安装要执行以下几个命令,(划重点!)

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

什么是Linux系统

Linux是一种免费使用和自由传播的类UNIX操作系统,是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统,使用Linux能运行主要的Unix工具软件、应用程序和网络协议。

到此,相信大家对“Linux下如何安装pyspider”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

推荐阅读:
  1. linux下安装ecshop,
  2. Linux下安装Redis及Linux下php安装Redis扩展

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux pyspider

上一篇:ubuntu中snap包安装、更新删除与使用的方法是什么

下一篇:ubuntu登录密码如何破解

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》