云服务器安装python3.8(源码安装)

云服务器安装python3.8(源码安装)

# 阿里云的centos默认装了python3.6

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel zlib* libffi-devel  -y

# 1前往用户根目录
>: cd ~

#2 下载 或 上传 Python3.8.6  服务器终端
wget https://registry.npmmirror.com/-/binary/python/3.8.6/Python-3.8.6.tgz

#3  解压安装包
tar -xf Python-3.8.6.tgz

#4 进入目标文件
cd Python-3.8.6

#5  配置安装路径:/usr/local/python3
# 把python3.8.6 编译安装到/usr/local/python38路径下
>: ./configure --prefix=/usr/local/python38

#6  编译并安装,如果报错,说明缺依赖
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel zlib* libffi-devel  -y
make &&  make install

#7  建立软连接:/usr/local/python38路径不在环境变量,终端命令 python3,pip3
ln -s /usr/local/python38/bin/python3 /usr/bin/python3.8
ln -s /usr/local/python38/bin/pip3 /usr/bin/pip3.8

python      2.x      pip 
python3      3.6      pip3
python3.8    3.8      pip3.8

#8  删除安装包与文件:
>: rm -rf Python-3.8.8
>: rm -rf Python-3.8.8.tar.xz

你可能感兴趣的:(云服务器,服务器,python,运维)