This guide provides a step-by-step process to install different versions of Python and manage them using virtual environments.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.9
sudo apt install python3.9-venv
5. Make a (hidden) Folder for Virtual Environments
mkdir ~/.venvs
- Note 1: You can change
my-venv-name
to your preferred name. - Note 2: You can also specify Python versions other than 3.9; however, the latest version is not always the most supported one. Beware!
python3.9 -m venv ~/.venvs/my-venv-name
source ~/.venvs/my-venv-name/bin/activate
python -V
pip3 --version
deactivate
- Active the environment,
my-venv-name
, again
source ~/.venvs/my-venv-name/bin/activate
- Install
ipython
andipykernel
pip install ipython ipykernel
- Configure the IPython Kernel for Jupyter Notebook
python -m ipykernel install --user --name=my-venv-name --display-name "My First Customised Kernel"