use update-alternatives to change python3 version

use update-alternatives to change python3 version

Step 1. install python3.8 and python3.10

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.10
sudo apt install python3.8

Step 2. add python3.8 and python3.10 selection number in update-alternatives

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2

Step 3. use this command to change python3 version

sudo update-alternatives --config python3

Step 4. check python3 version

python3 -V

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *