linux(服务器)下安装python3

Python publisher01 23℃

前言:

centos7自带了python2,现在都使用python3了,但是python2不能删除,要用到一些python2的命令,比如yum

正文:

1、输入python查看版本

1.1输入which python查看位置

2、开始安装依赖包:

yum -y groupinstall “Development tools”

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

3、根据自己的需求下载python3版本,我安装的是3.6.5:

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

4、建立存放路径:建立一个空文件夹,路径随意

mkdir /usr/local/python3

5、解压安装:

解压:tar -xvJf Python-3.6.5.tar.xz

切换目录:cd Python-3.6.5

配置:./configure –prefix=/usr/local/python3

安装:make && make install

6、创建软链接:

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

转载请注明:Python量化投资 » linux(服务器)下安装python3

喜欢 (0)or分享 (0)