centos7安装python3.10.5

一、下载安装

yum install  -y  wget vim lrzsz 
wget -c https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz 
tar -xf Python-3.10.5.tgz  -C /usr/local
#安装环境依赖
yum -y install libffi-devel  zlib zlib-devel
#编译安装
cd /usr/local/Python-3.10.5/
# 指定安装目录为/usr/local/Python-3.10.5
make
make install
./configure --prefix=/usr/local/Python-3.10.5  

二、加入环境变量

#加入环境变量
echo "export PATH=\$PATH:/usr/local/Python-3.10.5/bin" >>  /etc/profile
cat /etc/profile|grep "Python"
#使环境变量生效
source /etc/profile
#输入python回车确认有变量Python3
[root@harbor Python-3.10.5]# python3.10
Python 3.10.5 (main, Jan 25 2024, 12:56:24) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

你可能感兴趣的:(python,python,开发语言)