python3.7.3安装

安装依赖

  • 安装gcc编译器
1
2
3
yum -y install gcc

注:有些系统版本已经默认安装gcc,通过 gcc --version 查看
  • 安装其它依赖包
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 libffi-devel

下载python3.7.3安装包

1
# wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

安装python3.7.3

  • 创建安装目录,例:
1
2
3
# mkdir /usr/local/python3

注:安装路径可变
  • 解压下载的安装包
1
2
3
# tar zxvf /Python-3.7.3.tgz .

注: 解压路径可自行指定
  • 进入解压后的目录,编译安装
1
2
3
4
# cd Python-3.7.3
# ./configure --prefix=/usr/local/python3
...
# make && make install

建立软链接

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

测试

1
2
3
# python3

# pip3
-------------本文结束感谢您的阅读-------------