ubuntu系统的python3.6升级到python3.7
一、背景
Ubuntu系统中已经安装了python3.6,在不卸载python3.6的情况下安装python3.7
可以用
python --version
检查当前的版本
二、方法
1.安装python3.7
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
参考安装方法:https://www.jianshu.com/p/b8f11c04921a
2.改变环境变量
我在安装了之后,检查python的版本之后还是3.6,并不是3.7。还需要改变环境变量
echo alias python=python3.7 >> ~/.bashrc
source ~/.bashrc
参考方法:https://blog.youkuaiyun.com/xue_csdn/article/details/94588823