Linux installation
Install the interpreter, create an isolated workspace, and verify your first script in Terminal.
On this page
Install Python
Open Terminal and run python3 --version. If it prints 3.12 or newer, continue to the workspace step. If Python or virtual-environment support is missing, use the commands for your distribution.
Ubuntu or Debian — install the interpreter and the venv package:
sudo apt update
sudo apt install python3 python3-venvFedora — install Python through DNF:
sudo dnf install python3Check python3 --version again. The version supplied by the package manager depends on the distribution release. If it is older than 3.12, use your distribution’s documented parallel Python installation or a newer supported release. Keep the system interpreter available for its system tools.
Create your workspace
mkdir -p ~/python-study
cd ~/python-study
python3 -m venv .venv
.venv/bin/python -c "import sys; print(sys.executable); print(sys.prefix != sys.base_prefix)"Look for a path ending in .venv/bin/python, followed by True. These tell you exactly which interpreter ran and whether it belongs to a virtual environment.
Save and run a file
From this folder, enter nano hello.py or open a plain-text editor and save a file named hello.py here. Enter the Python line below. In nano, press Ctrl+O, Enter, then Ctrl+X to save and return to Terminal. Run the shell command below it.
print("Python is ready").venv/bin/python hello.pyThe expected result is Python is ready. If the file cannot be found, use pwd and ls to check your folder and filename. Build your first local project.