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:
bash: python: command not foundOr on Windows:
'python' is not recognized as an internal or external commandThis 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
pycommand, 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:
echo $PATH | grep /usr/local/binIf it is missing, add this line to your ~/.zshrc or ~/.bash_profile:
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:
python --version
python3 --versionUse 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:
python -m pip --versionIf 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:
python -m ensurepip --default-pipOn some Linux distributions, pip is a separate package. Install it through your package manager:
# Debian/Ubuntu
sudo apt install python3-pip
# Fedora
sudo dnf install python3-pipIf 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:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission deniedThis 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:
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# or .venv\Scripts\activate on Windows
python -m pip install requestsThis 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:
python -m pip install --user requestsNever 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 python3andwhich python3.14 - Windows:
where pythonorpy --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:
SyntaxError: invalid character '“' (U+201C)Or:
IndentationError: unexpected indentCopying 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:
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:
python -m pip --versionThe 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:
error: externally-managed-environmentThis 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
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.
Frequently Asked Questions
Why does my terminal say 'python is not recognized'?
Why do I need to type python3 instead of python?
pip install gives me a permission error. What should I do?
I have multiple Python versions installed. How do I know which one runs?
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.
More in this topic
Create and Assign Variables in Python
Learn every way to create and assign variables in Python, from basic single assignment to expressions, type hints, and practical patterns beginners use every day.
Python Variable Naming Rules
Learn Python's variable naming rules, including allowed characters, reserved keywords, PEP 8 conventions, and how to choose names that make your code readable.
Python Variables Explained
Understand what Python variables are, how they store and reference data, and why Python's variable model is different from other programming languages.