Install Python on Windows, Mac, and Linux: Step-by-Step

How to Install Python on Any Platform
Installing Python takes under 5 minutes on any operating system. The key steps are: download the correct installer from python.org, add Python to your system PATH, then verify the installation with python --version in your terminal.
Introduction to Python Installation
Installing Python is the first step in your programming journey. While it's as simple as installing any standard software, choosing the right version and configuring your system path correctly is crucial for a smooth development experience.
In this guide, we will cover how to install Python 3 across all major platforms:
- Windows
- Linux (Ubuntu & Building from source)
- macOS
- Mobile Devices (Android & iOS)
Python 2 vs Python 3
Python 2 officially reached its end of life on January 1, 2020. You should always install and use Python 3.x for any modern development.
1. Install Python on Windows
Unlike Linux or Mac, Windows does not come with Python pre-installed. However, the official installer makes it incredibly easy.
Downloading the Installer
- Visit the official Python website: python.org/downloads.
- Click the large Download Python 3.x.x button. The site will automatically detect you are on Windows.
The Installation Process
- Open the
.exefile you just downloaded. - CRITICAL STEP: At the bottom of the installation window, check the box that says "Add Python 3.x to PATH". If you miss this, Python won't easily run from your terminal!
- Click Install Now.
- Once completed, you should see a "Setup was successful" message.
Verifying the Installation
Open Command Prompt (cmd) and type:
If it prints Python 3.x.x, you are ready to code!
2. Install Python on Linux
Most Linux distributions come with Python pre-installed. However, older distros might default to Python 2.
To check your current versions, open your terminal (Ctrl + Alt + T):
Installing via apt (Ubuntu/Debian)
If you need to install or upgrade to the latest Python 3 version:
Setting Python 3 as Default
If typing python still runs Python 2, you can create an alias in your bash profile.
3. Install Python on macOS
macOS historically shipped with Python 2.7 (though newer versions have removed it). You'll need to install the latest Python 3 release.
Downloading the Installer
- Visit python.org/downloads/mac-osx/.
- Download the macOS 64-bit universal2 installer for the latest Python 3 release.
- Run the
.pkgfile and follow the standard installation wizard.
Verifying on Mac
Open your Terminal and type:
Using Homebrew
If you are a developer using Mac, the preferred way to install Python is via [Homebrew](https://brew.sh/). Simply run `brew install python` in your terminal.
4. Coding Python on Mobile
Yes, you can write and run Python scripts directly from your smartphone!
Python on Android
Search the Google Play Store for Pydroid 3 - IDE for Python 3. It provides an excellent offline Linux environment where you can even use libraries like Pandas, NumPy, and Matplotlib.
Python on iOS (iPhone/iPad)
Search the Apple App Store for Pythonista 3 or Pyto. Both provide robust environments for coding Python on the go.
5. Setting Up a Virtual Environment (All Platforms)
Once Python is installed, the next best practice is to create a virtual environment for each project. This isolates your project dependencies so different projects don't conflict with each other.
To deactivate the virtual environment when you're done, simply run:
6. Choosing a Code Editor
With Python installed, you need a code editor to write your scripts. Here are the top choices in 2026:
- VS Code (free) — the most popular editor. Install the official Python extension by Microsoft for IntelliSense, debugging, and linting.
- PyCharm Community Edition (free) — a full Python IDE with built-in virtual environment management.
- Jupyter Notebook (free) — ideal for data science and learning. Install with
pip install jupyter.
7. Installing Common Python Packages
Once your environment is ready, use pip (Python's package manager) to install libraries:
The official package repository is PyPI (pypi.org) — you can search for any library there.
Troubleshooting Common Installation Issues
| Problem | Solution |
|---|---|
python command not found | Re-run installer and check "Add to PATH" |
pip not recognised | Run python -m pip install <package> instead |
| Wrong Python version runs | Use python3 explicitly, or update PATH order |
| Permission denied on Linux | Add --user flag: pip install --user <package> |
What to Learn Next
Now that Python is installed and ready, here are the recommended next steps:
- Python for Beginners: Learn Python Programming — start coding from scratch
- Python Data Types — understand variables and built-in types
- Python Functions and Parameters — write reusable code blocks
- Exception Handling in Python — handle errors gracefully from day one
For version-specific installation notes, always refer to the official Python Setup and Usage documentation.
Conclusion
You are now equipped to run Python on any device! Whether you rely on Windows, develop on a Mac, run Linux servers, or just want to practice coding on the train via your phone—Python is everywhere.
Your next step is to choose a good Code Editor (like VS Code or PyCharm) and start writing your first scripts!
Common Mistakes When Installing Python
1. Installing Python without adding it to PATH
On Windows, the installer offers an "Add Python to PATH" checkbox that is unchecked by default in some versions. Skipping it means running python in the terminal gives a "command not found" error. Always check this box, or manually add C:\Users\YourName\AppData\Local\Programs\Python\Python3x\ and its Scripts\ subdirectory to your system PATH. The Python Windows FAQ explains PATH setup in detail.
2. Mixing system Python with pip-installed packages
Using pip install without a virtual environment installs packages globally, which can break system tools that depend on specific library versions. Always create a virtual environment first: python -m venv .venv and activate it before installing packages. See the venv documentation.
3. Using python vs python3 inconsistently
On macOS and many Linux distributions, python refers to Python 2 (or nothing), while python3 is the correct command for Python 3. On Windows with the Python Launcher, py -3 is the canonical way to invoke a specific version. Check your version with python --version and use aliases or the full path when automation scripts must target a specific version.
4. Not verifying pip is up to date after installation
Fresh Python installations often ship with an older version of pip. Running pip install with an outdated pip can cause resolver errors or fail to install packages that require recent pip features. Always run python -m pip install --upgrade pip immediately after creating a new environment.
5. Downloading Python from unofficial sources
Only download Python from python.org/downloads or your operating system's official package manager (e.g., brew install python on macOS, apt install python3 on Ubuntu). Third-party download sites have distributed malware-bundled Python installers. Verify the SHA256 checksum listed on the download page against the installer you download.
Frequently Asked Questions
Should I use the system Python or install my own?
On macOS and Linux, the system Python is used by OS tools and should not be modified. Install your own Python via python.org or a version manager like pyenv for development work. On Windows, there is no system Python, so install directly from python.org. The pyenv documentation explains managing multiple Python versions.
What is the difference between Python 3.11, 3.12, and 3.13? Each minor version adds language features, performance improvements, and security patches. Python 3.11 introduced significant interpreter speed improvements (10–60% faster than 3.10). Python 3.12 improved error messages and added new type system features. Python 3.13 introduced an experimental free-threaded mode (no GIL). For new projects, install the latest stable release. Check Python's release schedule for end-of-life dates before choosing a version for a long-lived project.
How do I run multiple Python versions on the same machine?
Use pyenv (macOS/Linux) or the Python Launcher py (Windows) to manage multiple installations. pyenv lets you set a global default (pyenv global 3.12.3) and a per-directory version (pyenv local 3.11.8 written to .python-version). On Windows, py -3.11 -m venv .venv creates a virtual environment using a specific installed version. The Python Launcher documentation covers all py command options.
Continue Learning
Still deciding whether Python is the right language to invest time in? Read Do You Really Need Python? — a practical guide that helps you decide based on your goals, whether that's web development, data science, automation, or career change.
