当前位置: 首页 > 工具软件 > ecs-deploy > 使用案例 >

【Python】使用阿里云ECS部署Python环境

巫马泰
2023-12-01

1.安装Python

cd /usr/local
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0a3.tar.xz
yum install gcc-c++ gcc make cmake zlib-devel bzip2-devel openssl-devel ncurse-devel libffi-devel -y

2.解压、配置、编译安装

tar xvf Python-3.8.0a3.tar.xz
mv Python-3.8.0a3 python-3.8
cd /usr/local/python-3.8
./configure
make && make install
python3 -V

3.删除,备份python2.7

mv /usr/bin/python /usr/bin/python.bak

4.建立软连接

ln -s /usr/local/bin/python3.8 /usr/bin/python
pip install --upgrade pip
python

5.修改yum依赖

vim /usr/bin/yum
将/usr/bin/python改为/usr/bin/python2.7
vim /usr/libexec/urlgrabber-ext-down
将/usr/bin/python改为/usr/bin/python2.7

6.验证yum功能

yum install -y wget
PS:一键部署:
链接:https://pan.baidu.com/s/1q5bECRgI2mghngQfGGaprw
提取码:57n5

 类似资料: