xxxxxxxxxx
#install python 3.9
!sudo apt-get update -y
!sudo apt-get install python3.9
#change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
#check python version
!python --version
#3.9.6
xxxxxxxxxx
# Choose one of the given alternatives:
!sudo update-alternatives --config python3
# This one used to work but now NOT(for me)!
# !sudo update-alternatives --config python
# Check the result
!python3 --version
# Attention: Install pip (... needed!)
!sudo apt install python3-pip
xxxxxxxxxx
#install python 3.9
!sudo apt-get update -y
!sudo apt-get install python3.9
#change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
#check python version
!python --version
#3.9.6
xxxxxxxxxx
## WORKING
# change python version
## check desired miniconda at https://repo.anaconda.com/miniconda/
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-x86_64.sh
%env PYTHONPATH = # /env/python
!chmod +x mini.sh
!./mini.sh -b -f -p /usr/local
!conda update conda
import sys
sys.path.append('/usr/local/lib/python3.8/site-packages')
!conda create -n myenv python=3.7
!python3 --version