Fix Common Python Installation Errors

Diagnose and fix the most common Python installation problems on Windows, macOS, and Linux.

6 min read

Python installation is straightforward for most people, but when something goes wrong, the error messages can be confusing. This article covers the most common problems beginners hit and how to fix each one quickly.

If you have not installed Python yet, start with the installation guide. If you are struggling with virtual environments or package installs, those articles cover environment-specific troubleshooting too.

"Command not found" or "not recognized"

This is the most common first-time error. You open a terminal, type python, and see:

plaintextplaintext
bash: python: command not found

Or on Windows:

plaintextplaintext
'python' is not recognized as an internal or external command

This means one of two things: Python is not installed, or it is installed but not on your system PATH. PATH is the list of folders your terminal searches when you type a command.

Check if Python is installed at all:

  • Windows: Look for "Python" in the Start Menu or in "Installed apps" in Settings. Also try the py command, which is the recommended launcher on Windows.
  • macOS: Look in /Applications/Python 3.14/ or run /usr/local/bin/python3 --version.
  • Linux: Most distributions include Python. Try python3 --version.

If installed but not found:

On Windows, the Python Install Manager (the modern installer from python.org) should add Python to PATH automatically. If using an older full installer, make sure the "Add Python to PATH" option was checked during installation. Re-run the installer and look for this option, or add the Python directory to PATH manually through System Settings.

On macOS, the python.org installer places symlinks in /usr/local/bin/. Make sure /usr/local/bin is in your PATH:

bashbash
echo $PATH | grep /usr/local/bin

If it is missing, add this line to your ~/.zshrc or ~/.bash_profile:

bashbash
export PATH="/usr/local/bin:$PATH"

The python vs python3 confusion

On macOS and Linux, running python may start Python 2 (if installed) or do nothing at all. Running python3 starts Python 3.

This is because the Python executable is named python3 to avoid conflicts with the older Python 2. On Windows, python and py both work because Python 2 was never a system component.

Test both commands:

bashbash
python --version
python3 --version

Use whichever one prints a Python 3 version (3.10 or later). Be consistent: if python3 works on your machine, use python3 everywhere you see python in tutorials. The same goes for pip vs pip3, though using python -m pip avoids this ambiguity entirely.

pip is not found

You installed Python, but pip install requests says "command not found."

First, try the module form instead, which is more reliable:

bashbash
python -m pip --version

If that works, always use python -m pip instead of bare pip. It guarantees you are using the pip tied to the Python you intend.

If python -m pip also fails, pip may not be installed. Bootstrap it:

bashbash
python -m ensurepip --default-pip

On some Linux distributions, pip is a separate package. Install it through your package manager:

bashbash
# Debian/Ubuntu
sudo apt install python3-pip
 
# Fedora
sudo dnf install python3-pip

If you wrote and ran your first Python program successfully but pip is missing, this is the most likely fix.

Permission errors when installing packages

You run pip install requests and see:

plaintextplaintext
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied

This happens when you try to install a package globally without the right permissions. The fix depends on your setup:

Best fix: use a virtual environment. Create and activate one before installing:

bashbash
python -m venv .venv
source .venv/bin/activate  # macOS/Linux
# or .venv\Scripts\activate on Windows
python -m pip install requests

This installs packages into .venv instead of the system Python. Read the virtual environments guide for more details.

If you cannot use a virtual environment, install for your user only:

bashbash
python -m pip install --user requests

Never use sudo pip install on macOS or Linux. It can overwrite system-managed Python files and break your operating system's Python installation. If you see a tutorial recommending sudo pip, that tutorial is outdated.

Wrong Python version runs

You run python --version and see Python 3.8 when you know you installed 3.14. Multiple Python versions can exist on one machine.

Find where each version lives:

  • macOS/Linux: which python3 and which python3.14
  • Windows: where python or py --list

On Windows with the Python Install Manager, py --list shows all installed versions and the default. Use py -V:3.14 to run a specific version.

On macOS, the python.org installer places versioned executables like python3.14 in /usr/local/bin/. Use the versioned command directly, or adjust your PATH so the desired version comes first.

If you installed Python through multiple methods (python.org installer, Homebrew, Anaconda), the one that appears first in PATH wins. Pick one installation method and uninstall the others to avoid confusion.

The Microsoft Store opens when I type python

On Windows, typing python without having it installed may open the Microsoft Store. This is a Windows feature that tries to help but often confuses beginners.

To fix it, install Python from python.org using the Python Install Manager, which is the recommended method as of 2026. After installation, python should work in your terminal.

If you still see the Store after installing, go to Start > "Manage app execution aliases" and make sure the Python aliases are enabled. If they are already enabled, toggle them off and back on to refresh.

SyntaxError or IndentationError from copied code

You copy an example from a web page, paste it into your editor, and see:

plaintextplaintext
SyntaxError: invalid character '“' (U+201C)

Or:

plaintextplaintext
IndentationError: unexpected indent

Copying code from websites sometimes brings invisible formatting characters or mixes tabs with spaces. Python requires consistent indentation.

Fix: Delete the pasted lines and retype them by hand, or use your editor's "Paste without formatting" option (Ctrl+Shift+V or Cmd+Shift+V). Make sure your editor is set to insert spaces when you press Tab, which is the default in VS Code, PyCharm, and most Python editors.

For more on Python's syntax rules, see Python syntax and indentation.

Pip installs packages but Python cannot find them

You run pip install requests successfully, but your script says:

plaintextplaintext
ModuleNotFoundError: No module named 'requests'

This means pip installed the package into a different Python environment than the one running your script. The most common cause is having pip for one Python version and running another.

Check which Python pip is using:

bashbash
python -m pip --version

The path in the output should match the Python you use to run scripts. If they differ, you have multiple Python installations. Use virtual environments to keep everything aligned: activate the environment, install packages with pip, and run scripts with Python, all from the same terminal session.

"externally-managed-environment" error on Linux

On modern Linux distributions (Debian 12+, Ubuntu 23.04+, Fedora), you may see:

plaintextplaintext
error: externally-managed-environment

This means your distribution blocks pip from modifying the system Python, which is a good thing. The fix is simple: create and use a virtual environment for your projects. This error is not a bug. It is a safety feature.

When to reinstall vs when to fix

If Python is completely missing or was installed incorrectly, reinstalling is faster than debugging. Uninstall first, then follow the installation guide with the defaults.

If Python works but has quirks (wrong version, pip missing, PATH issues), a targeted fix is usually faster than reinstalling. Work through the specific error sections above.

Once everything works, create your first Python project and set up your workspace so you have a clean environment ready every time you code.

Rune AI

Rune AI

Key Insights

Run python --version or python3 --version to check if Python is installed and on PATH; Use python -m pip instead of bare pip to avoid command-not-found issues; Permission errors mean you should use a virtual environment or pip install --user; On Windows, use the Python Install Manager from python.org for the smoothest setup.

RunePowered by Rune AI

Frequently Asked Questions

Why does my terminal say 'python is not recognized'?

Python is either not installed or not added to your system PATH. Reinstall Python and make sure the installer adds Python to PATH, or add the Python install directory to PATH manually.

Why do I need to type python3 instead of python?

On macOS and Linux, python often refers to Python 2 (if installed). The python3 command ensures you run Python 3. You can check which command works with python --version and python3 --version.

pip install gives me a permission error. What should I do?

Use a virtual environment instead of installing globally. If you must install globally, use pip install --user to install only for your account. Never use sudo pip install on macOS or Linux.

I have multiple Python versions installed. How do I know which one runs?

Run python --version or python3 --version to see the active version. Use which python (macOS/Linux) or where python (Windows) to see the full path to the executable.

Conclusion

Most Python installation errors come down to three things: Python not on PATH, the wrong command name, or missing pip. Check those first, and you will solve the majority of setup problems in under a minute.