zsh: command not found: python
The error message "zsh: command not found: python" indicates that the Zsh shell cannot find the "python" command in its search path. This typically occurs when the Zsh shell is unable to locate the Python executable, and as a result, it cannot execute Python commands or scripts.
Possible reasons for this error could be:
- Python is not installed: If Python is not installed on your system or not included in the system's PATH environment variable, the shell will be unable to locate the Python executable.
- Incorrect Python installation or version: If you have installed Python in a non-standard location or there is a misconfiguration, the Zsh shell may not be able to find the Python executable.
- Virtual environments: If you are using a virtual environment, you need to activate it first before running Python commands.
To resolve this error, you can take the following steps:
- Check if Python is installed on your system: Open a terminal and run "python --version" or "python3 --version" to check if Python is installed and accessible.
- Verify Python's PATH: Ensure that the directory containing the Python executable is included in your system's PATH environment variable.
- Activate virtual environments: If you are using virtual environments, activate the appropriate environment before running Python commands.
Python 2 installation has been removed from macOS
These errors occur because the system-provided Python 2 installation has been removed from Apple's macOS as of macOS 11 Big Sur. Consequently, users who were relying on it for their Python development environment may encounter the error message "zsh: command not found: python" when attempting to run the python command.
To resolve this issue, you need to install a newer version of Python, such as Python 3, or utilize a version manager like Homebrew or pyenv to manage your Python installations. These tools enable you to install multiple Python versions and switch between them as required, ensuring compatibility with your Python projects and avoiding the "command not found" error.
How to install Python using Homebrew:
Open your terminal and run the following command:
Add the following line to your .zshrc file:
Reload your terminal or run source ~/.zshrc to apply the changes.
After installation, you can verify that Python is installed by running the following command in your terminal:
With Python installed, you should no longer encounter the "zsh: command not found: python" error message when attempting to run the "python" command.
Python is not installed or executable not in the system's PATH.
Check if Python is installed: Open a terminal and run the following command:
If the output shows the version of Python, it indicates that Python is installed on your system. However, if you receive the same error message, it means that Python is not installed.
Install Python:
If Python is not installed, you can install it by following the instructions for your operating system. On a Debian-based system, you can run the following command:
Update PATH:
If Python is installed but its executable is not in the PATH, you can add it to the PATH by including the following line in your shell profile file (e.g., ~/.zshrc):
After adding the line, restart your terminal, or run the following command in your terminal to reload the profile file:
Now, running the command python should launch the Python interpreter without any error message.
Why Python removed?

Apple removed the system-provided Python 2 installation from macOS 11 Big Sur because Python 2 has reached its end of life, and it is no longer supported or considered secure. As a result, the Python development community no longer actively maintains Python 2.
To encourage users to adopt a newer and more secure version of Python, Apple decided to remove Python 2 from its latest operating system. Users are now encouraged to install a newer version of Python, such as Python 3, or use version managers like Homebrew or pyenv to handle their Python installations.
By removing Python 2, Apple is promoting the use of a secure and reliable version of Python for users' development projects, thereby ensuring a safer and more up-to-date programming environment.
Conclusion
The error "zsh: command not found: python" indicates that the Zsh shell cannot find the "python" command in its search path. This usually happens when Python is not installed or not included in the system's PATH environment variable. To resolve this, you should ensure that Python is installed on your system and its executable path is included in the PATH.
- TypeError: 'NoneType' object is not subscriptable
- IndexError: string index out of range
- IndentationError: unexpected indent Error
- ValueError: too many values to unpack (expected 2)
- SyntaxError- EOL while scanning string literal
- TypeError: Can't convert 'int' object to str implicitly
- IndentationError: expected an indented block
- ValueError: invalid literal for int() with base 10
- IndexError: list index out of range : Python
- AttributeError: 'module' object has no attribute 'main'
- UnboundLocalError: local variable referenced before assignment
- TypeError: string indices must be integers
- FileNotFoundError: [Errno 2] No such file or directory
- Fatal error: Python.h: No such file or directory
- ZeroDivisionError: division by zero
- ImportError: No module named requests | Python
- TypeError: 'NoneType' object is not iterable
- SyntaxError: unexpected EOF while parsing | Python
- Unicodeescape codec can't decode bytes in position 2-3
- The TypeError: 'tuple' object does not support item assignment
- The AttributeError: 'bytes' object has no attribute 'read'