阿里云服务器ECS(Centos8)下安装和配置python3.8
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
2.下载python包
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
3.解压后得到 Python3.8.0a1文件夹:
tar -xvJf Python-3.8.1.tar.xz
4.创建一个空的python3目录
mkdir /usr/local/python3
5.cd Python-3.8.1
6.编译,放到刚才生成的空目录中
./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
7.安装
make && make install
8.建立软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
9.cd /usr/local/python3/bin,查看目录中的文件,如果存在这几个文件,安装成功,顺便获取当前的路径,去配置环境变量
10.配置环境变量
export PATH=/usr/local/python3/bin:$PATH
11.回到根目录,查看:
(注:由于在安装配置过程中,Linux中默认安装的是python3.6。所以,最后我还是删除了python3.6的各个文件夹,直接下载安装python3.8和3.8的pip,才完成了现在的安装)