1.查看python版本
python -V
python --version
默认安装的是python2 的版本
2.添加本地yum源
mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv CentOS-Base.repo bk/
echo "[EL7]" >> centos7.repo
echo "name = linux 7.9 dvd" >> centos7.repo
echo "baseurl=file:///mnt" >> centos7.repo
echo "gpgcheck=0" >> centos7.repo
echo "enabled=1" >> centos7.repo
yum list
3.安装必要的支持文件
yum -y install gcc
yum -y install zlib zlib-devel
yum -y install bzip2 bzip2-devel
yum -y install ncurses ncurses-devel
yum -y install readline readline-devel
yum -y install openssl openssl-devel
yum -y install openssl-static
yum -y install xz lzma xz-devel
yum -y install sqlite sqlite-devel
yum -y install gdbm gdbm-devel
yum -y install tk tk-devel
yum -y install gcc*
cd /soft
tar -xvf Python-3.10.1.tgz
cd Python-3.10.1/
./configure --prefix=/usr/local/Python3/ --enable-optimizations
make
make install
4.修改环境变量
vi ~/.bash_profile
PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/local/Python3/bin;$HOME/bin
ln -s /usr/local/Python3/bin/python3 /usr/bin/python3
ln -s /usr/local/Python3/bin/pip3 /usr/bin/python3
linux 7 安装python 3.8
于 2020-05-10 21:52:45 首次发布