Codectionary / Developer documentation / Python

Use your distribution’s supported Python packages, keep the system interpreter intact, and run a first script.

Check before installing

Instructions checked 18 October 2026 against the official documentation linked below. Menu labels may differ between releases; verify the selected interpreter rather than relying only on its display name.

Linux distributions package Python differently. Start with python3 --version. This guide gives Ubuntu/Debian-family apt and Fedora dnf examples; do not run both sets or apply them to an unrelated distribution. Your distribution’s supported Python may be older than the latest python.org release.

Terminal — check the existing interpreter

python3 --version
python3 -c "import sys; print(sys.executable)"

Install through the distribution

On supported Ubuntu installations, python3-full supplies the standard library, venv support and IDLE; python3-pip supplies package tooling. On Debian-family systems, consult the release’s package catalogue if a package name is unavailable. Administrator rights are needed for system packages.

Fedora normally includes Python 3. Use its package manager if Python or pip is absent. On other distributions, follow their official package instructions. Do not replace /usr/bin/python3 or compile over the system interpreter.

Ubuntu — apt terminal commands

sudo apt update
sudo apt install python3-full python3-pip

Fedora — dnf terminal command

sudo dnf install python3 python3-pip

Run a saved program

Create a folder called python-practice in a location you can write to. Open it in your editor, create hello.py, and enter print("Hello, Python!"). Save it as plain text with the .py extension, not hello.py.txt. Open a terminal in that folder; the commands below run the saved file, not unsaved editor changes.

After changing into python-practice, run the command below. Expected output: Hello, Python! If you are inside >>>, enter exit() first. Installation and file-running commands are shell commands.

Terminal — inside python-practice

python3 hello.py

Keep project packages separate

An “externally-managed-environment” message protects distribution-managed Python. Create a virtual environment and install there; do not bypass it with sudo pip or --break-system-packages.

If venv reports missing ensurepip on Debian-family systems, install the matching python3-venv package for the interpreter you selected, or use the distribution’s complete Python package. Mixing different interpreter versions and venv packages can cause this error.

A missing Tk/IDLE package is separate from a missing Python interpreter. Install the distribution’s optional GUI package only if using that editor. For command-not-found errors, inspect command -v python3 before editing PATH.

Syntax

print("Hello, Python!")

Examples

Your first Python program

Save as hello.py in your project folder. Expected output: Hello, Python!

print("Hello, Python!")
  1. print is a built-in function that writes to the output stream.
  2. The quoted text is a string. The quotes are not printed.
  3. Parentheses pass that string to print. No extra package is required.

Best practices

  • Save your work before running it, and check the output after each small change.
  • Keep your learning project in its own folder. Do not name files after standard modules such as random.py or json.py.

Runtime & versions

Python interpreter. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Python language reference

Specifications & further reading