安装
准备工作
[root@tencent2c2g ~]# python --version
Python 2.7.5
可以看到已经安装了2.7.5
安装依赖
sudo 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.10.7
wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tgz
也可以直接自己去官网下载后上传;
#解压缩安装包
tar -zxvf Python-3.10.7.tgz
配置安装路径,配置的是/usr/local/python3
[root@tencent2c2g ~]# cd Python-3.10.7/
[root@tencent2c2g Python-3.10.7]# ls
aclocal.m4 config.guess configure Doc Include Lib Mac Misc netlify.toml Parser PCbuild pyconfig.h.in README.rst Tools
CODE_OF_CONDUCT.md config.sub configure.ac Grammar install-sh LICENSE Makefile.pre.in Modules Objects PC Programs Python setup.py
[root@tencent2c2g Python-3.10.7]# ^C
[root@tencent2c2g Python-3.10.7]# ./configure prefix=/usr/local/python3
/usr/local/为Path路径,一般存放用户应用
#编译安装python3
make && make install