How to Install Python
What you’ll build or solve
You’ll install Python on your computer and confirm your terminal can run it.
When this approach works best
This approach works best when you:
Learn Python on Mimo
- Need Python for a course, a coding project, or a tool that requires Python.
- Want a clean install on a new computer.
- Installed Python before but the terminal cannot find it, so you’re installing it again the right way.
Avoid this approach when:
- Your work or school manages your device and requires IT approval for installs.
- You’re setting up a production server. Use your server’s deployment process instead of installing by hand.
Prerequisites
- Internet connection to download the installer
- Permission to install software on your machine
- A terminal to verify the install
Step-by-step instructions
1) Download the Python installer from python.org
Go to Python.org.
The page detects your operating system and shows the latest stable version.
Click Download Python 3.x.x to get the installer for your platform.
If you see multiple download buttons, pick the one that matches your OS (Windows, macOS, or your Linux distro).
After installation finishes, you can delete the installer file.
2) Install on Windows
Option A (most common): Install from python.org
Run the installer you downloaded and make these choices:
- Check Add python.exe to PATH on the first screen.
- Select Install Now unless you need a custom location.
Open a new PowerShell window and verify:
CSS
python--version
py-V
python-m pip--version
What to look for:
py -V uses the Windows Python Launcher. If py -V works but python --version does not, PATH is the issue.
Option B (alternative): Install with winget
SQL
winget search Python.Python.3
winget install Python.Python.3
Verify:
SQL
python--version
python-m pip--version
where python
What to look for:
where python can show multiple entries. The first one is what runs when you type python.
3) Install on macOS
Option A (most common): Install with Homebrew
SQL
brew update
brew install python
Verify:
CSS
python3--version
python3-m pip--version
which python3
What to look for:
which python3 often points to /opt/homebrew/bin/python3 (Apple Silicon) or /usr/local/bin/python3 (Intel).
Option B (alternative): Install from python.org
Run the installer from python.org, then verify:
CSS
python3--version
python3-m pip--version
which python3
If your terminal still points to an older location, PATH order is likely the cause.
4) Install on Linux
Linux installs depend on your distro. Most of the time, install Python using your package manager.
Option A (most common): Use your package manager
Ubuntu/Debian example:
Bash
sudo apt update
sudo apt install python3 python3-pip
Verify:
CSS
python3--version
python3-m pip--version
which python3
Option B (alternative): Use pyenv for a newer version
If your distro’s Python is older than what you need, pyenv lets you install a newer version for your user account.
After installing pyenv, install and select a version:
CSS
pyenv install3.12.8
pyenv global3.12.8
python--version
python-m pip--version
What to look for:
If your shell still runs the old version, restart your terminal or complete the pyenv shell setup.
5) Create a virtual environment for your first project
A virtual environment keeps project packages separate from the system install.
Create a venv in your project folder:
python-m venv .venv
Activate it:
Bash
# macOS/Linux
source .venv/bin/activate
# Windows PowerShell
.\.venv\Scripts\Activate.ps1
Upgrade pip inside the venv:
CSS
python-m pip install--upgrade pip
What to look for:
Your prompt usually changes when the venv is active, and:
python-c"import sys; print(sys.prefix)"
points to the .venv path.
6) Verify Python and pip work correctly
Run a quick check that Python and pip work and that you’re using the interpreter you expect:
python-c"import sys; print(sys.version); print(sys.executable)"
python-m pip--version
If you’re on macOS/Linux and use python3, run:
python3-c"import sys; print(sys.version); print(sys.executable)"
python3-m pip--version
Examples you can copy
Example 1: Windows install from python.org, then verify
SQL
python--version
py-V
python-m pip--version
where python
Use this when you want to confirm both PATH and the launcher are set up.
Example 2: macOS Homebrew install and version check
CSS
brew install python
python3--version
which python3
python3-m pip--version
Use this when you want a Homebrew-managed Python for development.
Example 3: Linux apt install, then create a venv
Bash
sudo apt update
sudo apt install python3 python3-pip
python3--version
python3-m venv .venv
source .venv/bin/activate
python-m pip install--upgrade pip
Use this when you’re starting a new project and want isolated dependencies.
Common mistakes and how to fix them
Mistake 1: Installing Python, but python is “not recognized” on Windows
You install Python, then run:
CSS
python--version
and get a “not recognized” error.
Why it happens:
Python was not added to PATH, or a different python.exe is taking precedence.
Fix:
Bash
py-V
where python
If py -V works but python does not, reinstall from python.org and select Add python.exe to PATH, or adjust PATH so the correct folder appears first.
Mistake 2: Installing packages with pip, but imports still fail
You run:
pip install requests
but import requests fails.
Why it happens:
pip installed into a different Python than the one running your code.
Fix: always run pip through Python:
python-m pip install requests
python-c"import requests; print(requests.__version__)"
If you use python3, do:
python3-m pip install requests
Troubleshooting
- If you see
python: command not foundon macOS/Linux, usepython3instead. - If
pyworks butpythondoesn’t on Windows, fix PATH or reinstall with “Add python.exe to PATH” selected. - If pip installs to the wrong place, use
python -m pipand verify withpython -c "import sys; print(sys.executable)". - If you get permission errors on Linux when installing packages, use a virtual environment instead of installing globally.
- If you keep seeing an older version, check which executable runs:
python-c"import sys; print(sys.executable)"
Quick recap
- Download the installer from python.org.
- Install Python using the method that fits your OS.
- Verify the version and interpreter path in your terminal.
- Create a virtual environment for projects.
- Use
python -m pipto install packages into the right Python. - Recheck PATH or interpreter selection if the version looks wrong.
Join 35M+ people learning for free on Mimo
4.8 out of 5 across 1M+ reviews
Check us out on Apple AppStore, Google Play Store, and Trustpilot