python --version


说明是安装过python的,运行相应的bin/python便可以。如/usr/bin/python3.6
通过which python找到默认的安装路径

下载地址:
https://www.python.org/downloads/source/

上传:

解压:
tar -xvzf Python-3.12.0a1.tgz
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
进入到Python的目录中,如cd Python-3.12
./configure --prefix=/usr/local/tools/Python-3.12
make
make install
ln -s /usr/local/tools/Python-3.12/bin/python3.12 /usr/bin/python3
ln -s /usr/local/tools/Python-3.12/bin/pip3.12 /usr/bin/pip3
ls -l /usr/bin/
python3
执行 vi ~/.bash_profile
export PYTHON_HOME=/usr/local/tools/Python-3.12
export PATH=$PYTHON_HOME/bin:$PATH
使配置文件 生效:source ~/.bash_profile