Centos安装python3.7.5

1. 安装依赖

# yum install gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel tk-devel wget curl-devel

2. 下载python3

先进入下载目录
# cd /home
# wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

3. 解压文件

# tar -zxvf Python-3.7.5.tgz 
进入Python-3.7.5
# cd /Python-3.7.5

4. 创建安装目录

软件一般安装在/usr/local目录下,方便管理。
# mkdir /usr/local/python3

5. 编译python3

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

6. 安装python3

# make
# make install

7. 建一个软链接

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

你可能感兴趣的:(Centos安装python3.7.5)