Installation #
Python is available on every major platform and can be installed in minutes — but a few small details are often overlooked and come back to bite you later: version conflicts, pip not registered on PATH, or a system Python that got clobbered. This article walks you through installing Python properly from the start: choosing the right version, the install process for each operating system, verifying that every component actually works, and picking an editor that makes writing Python comfortable.
Choosing a Python Version #
Before downloading anything, it’s important to understand which version you should pick. Many beginners grab an old version because the tutorial they’re following still uses it — that’s a habit worth breaking.
Python support timeline:
Python 2.7 ──── EOL January 2020 ──── NO LONGER SUPPORTED
Python 3.9 ──── EOL October 2025 ──── almost EOL
Python 3.10 ──── EOL October 2026 ──── still active
Python 3.11 ──── EOL October 2027 ──── recommended
Python 3.12 ──── EOL October 2028 ──── recommended
Python 3.13 ──── EOL October 2029 ──── newest (2024)
Use Python 3.11 or 3.12 for new projects. Both are stable, widely supported by third-party libraries, and receive active security patches. Avoid Python 2 — it hasn’t had security updates since 2020.
Check the latest version and the official EOL schedule at python.org/downloads. That page always shows which versions are still in security fixes status and which are already end-of-life.
Installing on Windows #
Windows doesn’t ship with Python by default. There are two main approaches: the official installer from python.org, or the Windows Package Manager (winget). The official installer is easier for beginners to follow because it has a graphical interface.
Using the Official Installer #
Step 1 — Download the installer:
Open python.org/downloads and click the big yellow button showing the latest version. The downloaded file ends in .exe, for example python-3.12.3-amd64.exe.
Step 2 — Run the installer with the right options:
// ANTI-PATTERN: clicking "Install Now" straight away without reading the options
// This leaves Python off your PATH — you can't run 'python' from any
// Command Prompt.
// CORRECT: tick "Add python.exe to PATH" BEFORE clicking Install Now
// This option sits at the bottom of the installer's first screen.
After ticking the PATH option, choose “Install Now” for a standard installation, or “Customize installation” if you want to change the destination directory.
Step 3 — Verify the installation:
Open Command Prompt (press Win + R, type cmd, Enter) and run:
python --version
pip --version
Expected output:
Python 3.12.3
pip 24.0 from C:\Users\<username>\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12)
Using winget (Windows 11 / recent Windows 10) #
This route is faster and a good fit if you’re comfortable with the terminal:
winget install Python.Python.3.12
When it finishes, open a new terminal and verify as in step 3 above.
Fixing PATH Issues on Windows #
If python isn’t recognized in Command Prompt after installation, PATH hasn’t been configured. Fix it manually:
1. Open: Control Panel → System → Advanced system settings
2. Click: Environment Variables
3. Under "System variables", find the "Path" variable → click Edit
4. Click "New" and add these two paths:
C:\Users\<username>\AppData\Local\Programs\Python\Python312\
C:\Users\<username>\AppData\Local\Programs\Python\Python312\Scripts\
5. Click OK → OK → OK
6. Close and reopen Command Prompt
Don’t add Python to PATH manually if you have several Python versions installed. That can cause version conflicts that are painful to debug. Use a tool like pyenv-win to manage multiple Python versions on Windows.Installing on macOS #
macOS usually ships with Python, but the version is Python 2.7 or a very old Python 3 — neither is suitable for active development. Always install your own Python and don’t rely on the system one.
Using Homebrew (Recommended) #
Homebrew is the most popular package manager on macOS. If it isn’t installed yet:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is ready, install Python:
brew update
brew install [email protected]
Homebrew installs Python and pip together. Verify:
python3 --version
pip3 --version
Configuring PATH on macOS #
Homebrew installs Python into /usr/local/bin/ (Intel Mac) or /opt/homebrew/bin/ (Apple Silicon). Add it to your shell profile:
# For zsh (default on macOS Catalina and later)
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# For bash
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Aliasing python → python3 #
macOS doesn’t provide a python alias pointing at Python 3 by default. Add one so your commands match the tutorials:
echo 'alias python=python3' >> ~/.zshrc
echo 'alias pip=pip3' >> ~/.zshrc
source ~/.zshrc
After this, both python and python3 will use Python 3.
Installing on Linux #
Most modern Linux distributions already ship with Python 3. But the version may not be the newest, and pip may not be installed alongside it.
Ubuntu / Debian #
# Update the package list
sudo apt update
# Install Python 3 and pip together
sudo apt install python3 python3-pip python3-venv -y
# Verify
python3 --version
pip3 --version
To install a specific, newer Python version than what the Ubuntu repositories offer, use the deadsnakes PPA:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.12 python3.12-venv python3.12-dev -y
# Install pip for the specific version
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
Fedora / RHEL / CentOS #
# Fedora (dnf)
sudo dnf update -y
sudo dnf install python3 python3-pip -y
# Verify
python3 --version
pip3 --version
For a specific Python version on Fedora:
# Example: Python 3.12
sudo dnf install python3.12 -y
Creating Aliases on Linux #
Just like macOS, you can create aliases so you can use python instead of python3:
echo 'alias python=python3' >> ~/.bashrc
echo 'alias pip=pip3' >> ~/.bashrc
source ~/.bashrc
Don’t remove or overwrite the Python that already exists on your Linux system (usually at/usr/bin/python3). Many system tools such asapt,dnf, and maintenance scripts depend on the system Python. If you break it, your system can become unstable. Always use a virtual environment for your projects.
Complete Installation Verification #
After finishing the installation on your platform of choice, it’s important to check step by step that Python and pip (the package manager) are properly installed and reachable from your terminal or Command Prompt.
Here’s a flow diagram of the initial setup and installation verification:
flowchart TD
Start["Start Python Setup"] --> Download["Download Official Installer from python.org"]
Download --> Install["Run the Installation Process"]
Install --> CheckPath{"Is it Windows?"}
CheckPath -->|Yes| PathCentang["IMPORTANT: Tick 'Add python.exe to PATH'"]
PathCentang --> RunInstall["Choose 'Install Now'"]
CheckPath -->|"No (macOS / Linux)"| RunInstall
RunInstall --> OpenTerminal["Open a New Terminal / Command Prompt"]
OpenTerminal --> VerifyPython["Run: python --version"]
VerifyPython --> VerifyPip["Run: pip --version"]
VerifyPip --> TestInstall["Test Package Installation:<br/>pip install requests"]
TestInstall --> Success["Setup Complete & Successful!"]To run that verification on your system, execute the following command-line checks in a freshly opened terminal or Command Prompt:
# 1. Check the Python version
python --version
# or: python3 --version
# 2. Check the pip version
pip --version
# or: pip3 --version
# 3. Make sure pip can install packages
pip install requests
# 4. Test the newly installed package
python -c "import requests; print(requests.__version__)"
# 5. Check the active Python location
# Windows:
where python
# macOS/Linux:
which python3
Expected output from step 4:
2.31.0
If every step above runs without errors, your Python installation is ready to use.
Choosing an Editor / IDE #
Python can be written in any text editor, but picking the right tools makes coding far more comfortable — especially with autocomplete, linting, and integrated debugging.
Visual Studio Code (Recommended for Beginners) #
VS Code is Microsoft’s free editor and currently has the best Python extension ecosystem.
# macOS (via Homebrew)
brew install --cask visual-studio-code
# Ubuntu
sudo snap install --classic code
# Windows: download from code.visualstudio.com
Once VS Code is installed, add Microsoft’s Python extension:
1. Open VS Code
2. Press Ctrl+Shift+X (or Cmd+Shift+X on macOS)
3. Search for "Python" → pick the Microsoft extension → Install
4. Open your first .py file → VS Code will automatically detect the Python interpreter
PyCharm (Recommended for Large Projects) #
PyCharm is JetBrains’ dedicated Python IDE. Its Community edition is free and already very complete.
# macOS (via Homebrew)
brew install --cask pycharm-ce
# Ubuntu / Fedora
sudo snap install pycharm-community --classic
# Windows: download from jetbrains.com/pycharm
Jupyter Notebook (for Data Science) #
If you plan to work in data science or machine learning, Jupyter Notebook is an interactive and hugely popular environment:
pip install jupyter
jupyter notebook
The second command opens your browser automatically with the Jupyter interface.
Quick comparison:
| Tool | Best for | Free? |
|---|---|---|
| VS Code | General, web, scripting | ✓ |
| PyCharm CE | Medium-to-large projects | ✓ |
| PyCharm Pro | Django, FastAPI, DB | ✗ |
| Jupyter Notebook | Data science, exploration | ✓ |
| IDLE | Learning the basics | ✓ (built-in) |
Summary #
- Use Python 3.11 or 3.12 — avoid Python 2 which is already EOL, and 3.x versions nearing EOL.
- Tick “Add to PATH” when installing on Windows — this is the step most often skipped and the source of most problems.
- Don’t rely on the system Python on macOS and Linux — install a separate version via Homebrew or apt.
- Include
python3-venvwhen installing on Ubuntu — the venv module is required to create virtual environments and isn’t always installed automatically.- Don’t remove the system Python on Linux — many OS tools depend on it; always isolate projects using a virtual environment.
- Verify with
pip installandimport— making sure Python can download packages and import modules is the most practical test that the installation works correctly.- VS Code + the Python extension is the most recommended combination for beginners because it’s free, lightweight, and full-featured.