centos7 安装 python3.6

1. 安装依赖环境

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. 浏览器打开 https://www.python.org/ftp/python/ 查看最新的Python版本,标记为3.A.B

# wget https://www.python.org/ftp/python/3.A.B/Python-3.6.0.tgz


3. 创建Python3的目录

mkdir /usr/local/python3 .6


4. 解压下载文件并切换目录

# tar -zxvf Python-3.6.0.tgz

# cd Python-3.6.0


5. 执行

# ./configure --prefix=/usr/local/python3.6

# make && make install


6. 创建Python3的软链接

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

7.配置环境变量

## vim /etc/profile
在最后,添加:
export PATH="/usr/local/python3.6/bin:$PATH" #添加的路径
保存,退出,然后运行:
#source /etc/profile
不报错则成功。

你可能感兴趣的:(python)