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 ~]# python Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> quit() [root@hadron ~]# python3 Python 3.5.5 (default, Feb 27 2018, 09:28:49) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> quit() [root@hadron ~]# [root@hadron ~]# pip3 --version pip 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 -v Scrapy 1.5.0 - no active project
相关推荐
chuckchen 2020-10-31
Will0 2020-10-12
Dreamhome 2020-10-09
xirongxudlut 2020-09-28
星辰大海的路上 2020-09-13
chaochao 2020-08-31
猪猪侠喜欢躲猫猫 2020-08-17
快递小可 2020-08-16
shengge0 2020-07-26
巩庆奎 2020-07-21
张文倩数据库学生 2020-07-19
xirongxudlut 2020-07-18
Ericbig 2020-07-18
kyelu 2020-07-09
liangzhouqu 2020-07-07
GuoSir 2020-06-28
chaigang 2020-06-27
pythonxuexi 2020-06-25