Python is one of the easiest scripting languages to learn. However, setting up a proper development environment for Python can be confusing due to the long history of fragmented tools, virtual environments, and legacy packaging systems. This quickstart is designed for both first-time learners and experienced developers who just need a fuss-free way to set up Python to start coding.
This opinionated guide focuses on a mainstream Python workflow on Linux, which includes tools, commands, and conventions widely recommended in 2026, while briefly covering older approaches that you can safely skip over.
Use Python 3 for your new projects.
Python 2 is obsolete and deprecated since 2020.
Use the newest stable version of Python that has a reasonable End-of-Life (EOL) timeline for your use case. Refer to the status of Python versions on EOL information.
As Python often comes pre-installed with Linux, Linux is generally easier (than Windows) to setup Python.
For Ubuntu 24.04, use the following commands to setup Python3
sudo apt update
sudo apt install python3 python-is-python3
💡 Tip
Installing Python, as described above, limits you to the “latest” version supported by the system, which may not be updated to the latest version of Python. Developers generally prefer to use the
uvversion management tool, which allows them to deploy specific Python versions for each project. If you are starting on Python, I recommend using theuvtool to set up Python.
For Windows, download the installer from the official Python website to install Python.
The uv version management tool comes with a ruff linting and formatting
tool for Python source code. Linters help you catch mistakes early in your
source code and help build good coding habits in developers. Using a common
formatting tool simplifies source code readability and maintenance among
developers working on the same project.
uvThe instruction below guides you on how to install Python using uv on
Ubuntu 24.04:
[Optional prerequisites] Ensure that your system has the following tools installed to proceed with the subsequent steps.
sudo apt install curl
Install latest version of uv using the official stand-alone
installer.
curl -LsSf --tlsv1.3 https://astral.sh/uv/install.sh | sh
💡 Tip
To upgrade
uv, use theuv self updatecommand.To uninstall
uv, use the following commandsuv cache clean rm -r "$(uv python dir)" rm -r "$(uv tool dir)"
Restart your shell to activate uv environment settings.
Use the following command to validate that uv has been properly installed.
You should see the version number printed to terminal.
uv self version
Install a specific version of Python.
uv python install 3.13
💡 Tip
To upgrade a specific Python version to the latest patch release, use
uv python upgrade 3.13.
Check that Python was installed properly.
uv python list
Set a project to use a specific version of Python.
mkdir hello-world
cd hello-world
uv python pin 3.13
💡 Tip
To set a global default version of Python in your user account, use
uv python pin --global 3.13.
Check the version of Python executed by uv in the project.
uv run python --version
uvOnce you have set up the target Python version with uv above, you can run
Python scripts in the following ways
Run script without 3rd-party dependencies.
uv run hello-world.py
ℹ️ Note
Usage of modules from the Python standard libraries is supported in this mode of running Python scripts.
Run script with 3rd-party dependencies (ideally within a project).
Create a new Python project with uv.
mkdir hello-world
cd hello-world
uv init
Run the Python project.
uv run main.py
💡 Tip
For more information on working on projects with
uv, read the official documentation.
ruffTo use a linter to check your Python source code in a project, follow the steps below
(One-time setup) Install latest version of ruff globally.
uv tool install ruff@latest
Format code style for all Python source files in current directory.
ruff format
Lint (check) all Python source files in current directory.
ruff check
Python developers are rapidly consolidating around the new generation of tools,
such as uv and ruff, which are designed to replace the older fragmented
toolchain. However, many active Python projects have yet to migrate to the new
toolchains and will likely take a few years for the entire Python ecosystem to
complete migration.
New and experienced developers will need to recognise these older tools when there is a need to integrate the new toolchain with older Python projects. The following table summarises the list of old tools and the superseding new tools.
| Old Tool | Purpose | Equivalent New Tool |
|---|---|---|
pyenv |
Version manager for Python | uv python install |
pip |
Install packages | uv add |
python -m venv |
Create virtual environments | uv |
pipenv |
Package + env management | uv |
poetry |
Dependency management | uv |
requirements.txt |
List dependencies used by pip |
uv uses pyproject.toml |
flake8 / pylint |
Linting | ruff check |
black |
Formatting | ruff format |
virtualenv |
Older venv tool |
Obsolete since Python 3.3 |
conda |
Python + non-Python packages | Only needed for scientific stacks |