Gnome terminal will only run when python3.6
is used. So I created an environment and installed python3.9
like so:
#!/usr/bin/env bash
sudo apt install python3-venv
python3 -m venv test_env
source test_env/bin/activate
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
apt list | grep python3.9
sudo apt-get install python3.9
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
sudo update-alternatives --config python3
python3 -V
However this causes the whole system to switch to python3.9
and prevents terminal from working. How can I prevent this?
Now, running source ~/.bashrc
allows the non-venv terminal to continue working. And python -V
reports the correct version of 3.6
. But if I close the window I can't reopen it. I have to use a terminal in my IDE to reselect the older version of python. Running:
sudo update-alternatives --install /usr/bin/python3 python3
Shows that actually, version 3.9
is selected. Even though python -V
actuallt reports running python3.6
:
# Python 3.6.9
# Selection Path Priority Status
# ---------------------------------------------
# 0 /usr/bin/python3.9 2 auto mode
# 1 /usr/bin/python3.10 2 manual mode
# 2 /usr/bin/python3.6 1 manual mode
#* 3 /usr/bin/python3.9 2 manual mode