Python#
Let us setup your computer to develop in Python and use Python software.
Alternative installation methods
There are of course other ways to install Python for specific tasks, for example pyenv and guix.
Install Python#
On Windows and macOS, it is reasonable to install Python from the official Python website (https://www.python.org).
On Linux, one usually already has a Python interpreter. However, for Python developers, it is usually useful to install few missing parts.
Install Python by downloading and executing an installer here: https://www.python.org/downloads/windows/.
You can install Python following the instructions of this page.
Alternatively, just run:
brew install python
sudo apt install python3-dev python3-venv
Note that the Debian packages python3-full and/or pipx can also be useful.
It is usually better to avoid the package python3-pip since its usage is now not the
best solution in most cases.
Note
For Windows, you should install Python twice, on the Windows and the Ubuntu-WSL sides.
Python virtual environments on Linux
Some Linux distributions split Python in small bits, and it is possible to install Python
without some packages of the standard library. This is in particular the case of the
Python package venv, used to create virtual environments, which is provided in Ubuntu
with the Ubuntu package python3-venv. Virtual environments are so important for the
Python ecosystem that it is usually useful to install this package.
UV#
UV is a new Python package and project manager written in Rust by the company Astral.
Install UV as
described in the UV website.
Once this is done, open a new terminal and the command uv should be available (one can
check uv --version or uv -h).
Then, we can use this command to install other software, for example PDM:
uv tool install pdm
or JupyterLab
uv tool install jupyterlab --with scipy,pandas,matplotlib,ipympl,jupyterlab-myst,jupyterlab-spellchecker,jupytex
We will also use UV to install Mercurial, as presented later.