centos 安装python3.6

环境准备

yum -y update
yum install -y openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ automake autoconf libtool make

首先去官网下载python3.6

https://www.python.org/ftp/python/

创建python3.6目录

mkdir /usr/local/python3.6
cd /usr/local/python3.6

这里我们下载

yum -y install wget  # 安装wget
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz

解压python3.6安装包

tar -xzvf Python-3.6.8.tgz

进入解压路径

cd Python-3.6.8

源码安装三个步骤

# 配置(configure)
./configure --prefix=/usr/local/python3.6 # 编译(make)
make # 安装(make install)
make altinstall

建立软连接

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

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

加入环境变量

在vim /etc/profile最后一行中加入变量

export PATH="$PATH:/usr/local/python3.6/bin"
# 使环境变量生效
source /etc/profile

检测是否安装成功

python3.6    # 进入python3.6

pip3.6 -V    # 显示pip的版本
上一篇:CSS height:100%无效


下一篇:FlashFXP链接到服务器上,如果www目录下的文件隐藏