Using Multiple Versions of Python Concurrently

Workbench

Posit Workbench users can switch between multiple versions of Python. Assuming that you installed Python following the instructions on the Installing Python page, users can identify all available versions of Python by running the following command:

$ ls -1d /opt/python/*
/opt/python/3.7.14
/opt/python/3.8.14
/opt/python/3.9.14
/opt/python/3.10.7

Users can choose the specific interpreter they want to use by directly invoking the absolute path to the interpreter. For example:

$ /opt/python/3.10.7/bin/python3

We recommend that users use virtual environments. Users can create a virtual environment with a specific version of Python by directly invoking the absolute path of the Python interpreter they wish to use. For example:

$ /opt/python/3.10.7/bin/python3 -m venv .venv
$ source .venv/bin/activate
$ which Python
/home/<USER-NAME>/.venv/bin/python
$ Python --version
Python 3.10.7

For more information, please refer to the Posit Workbench User Guide: