科技常识:CentOS下安装python3.5+scrapy的方法步骤

2021-04-13 05:11:09
导读 今天小编跟大家讲解下有关科技常识:CentOS下安装python3 5+scrapy的方法步骤,相信小伙伴们对这个话题应该也很关注吧,小编也收集到了有关

今天小编跟大家讲解下有关科技常识:CentOS下安装python3.5+scrapy的方法步骤,相信小伙伴们对这个话题应该也很关注吧,小编也收集到了有关科技常识:CentOS下安装python3.5+scrapy的方法步骤的相关资料,希望小伙伴会喜欢也能够帮助大家。

前言:不用改掉系统python2.7 ,原来是python2.7,我们还进行python2.7的保留

1.编译前准备其他库的安装(使用sudo命令)

[root@hadron ~]# yum -y groupinstall"Development tools"[root@hadron ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2.下载python3安装压缩包->解压->进入目录->编译->安装

[root@hadron ~]# wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz[root@hadron ~]# tar -zxvf Python-3.5.5.tgz [root@hadron ~]# cd Python-3.5.5/[**加粗文字**root@hadron ~]# ./configure --prefix=/usr/local/python3[root@hadron ~]# make && make install

3.创建Python3,pip3的软链接

[root@hadron ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3[root@hadron ~]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

4.验证Python3 和pip3 是否安装成功

[root@hadron ~]# pythonPython 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2Type"help","copyright","credits"or"license"for more information.>>> quit()[root@hadron ~]# python3Python 3.5.5 (default, Feb 27 2018, 09:28:49) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linuxType"help","copyright","credits"or"license"for more information.>>> quit()[root@hadron ~]# [root@hadron ~]# pip3 --versionpip 9.0.1 from /usr/local/python3/lib/python3.5/site-packages (python 3.5)

5.安装Scrapy爬虫框架

安装过程中如果出现红色代码,可能是网络原因,请试多几次

[root@hadron ~]# pip3 install scrapy

6. 验证是否安装成功

[root@hadron ~]# python3[root@hadron ~]# >>>import scrapy[root@hadron ~]# >>>

上面也是验证Scrapy框架安装成功,因为我们进行了import scrapy没有进行报错。

7.创建Scrapy软链接

[root@hadron ~]# ln -s /usr/local/python3/bin/scrapy /usr/bin/scrapy

8. 验证Scrapy软链接

[root@hadron ~]# scrapy -vScrapy 1.5.0 - no active project

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持爱蒂网。

来源:爱蒂网

免责声明:本文由用户上传,如有侵权请联系删除!

猜你喜欢

最新文章