We Are Going To Discuss About How to fix “zsh: command not found: python” error? (macOS Monterey 12.3, python 3.10, Atom IDE, atom-python-run 0.9.7). So lets Start this Python Article.
How to fix “zsh: command not found: python” error? (macOS Monterey 12.3, python 3.10, Atom IDE, atom-python-run 0.9.7)
- How to solve”zsh: command not found: python” error? (macOS Monterey 12.3, python 3.10, Atom IDE, atom-python-run 0.9.7)
Anyone updating their macOS to Monterey 12.3 will find that they suddenly no longer have the system provided Python 2.
The reason for this is that Apple removed the system-provided python 2 installation (details).
So a workaround/solution for this is to use pyenv to install python 2.7 (or any other specific version you need).
Installpyenv
withbrew
to manage different python versions:brew install pyenv
List all installable versions withpyenv install --list
Install python 2.7.18 withpyenv install 2.7.18
List installed versions withpyenv versions
Set global python version withpyenv global 2.7.18
Addeval "$(pyenv init --path)"
to~/.zprofile
(or~/.bash_profile
or~/.zshrc
, whichever you need)
Relaunch the shell and check that python works.
- How to fix “zsh: command not found: python” error? (macOS Monterey 12.3, python 3.10, Atom IDE, atom-python-run 0.9.7)
Anyone updating their macOS to Monterey 12.3 will find that they suddenly no longer have the system provided Python 2.
The reason for this is that Apple removed the system-provided python 2 installation (details).
So a workaround/solution for this is to use pyenv to install python 2.7 (or any other specific version you need).
Installpyenv
withbrew
to manage different python versions:brew install pyenv
List all installable versions withpyenv install --list
Install python 2.7.18 withpyenv install 2.7.18
List installed versions withpyenv versions
Set global python version withpyenv global 2.7.18
Addeval "$(pyenv init --path)"
to~/.zprofile
(or~/.bash_profile
or~/.zshrc
, whichever you need)
Relaunch the shell and check that python works.
Solution 1
Anyone updating their macOS to Monterey 12.3 will find that they suddenly no longer have the system provided Python 2.
The reason for this is that Apple removed the system-provided python 2 installation (details).
So a workaround/solution for this is to use pyenv to install python 2.7 (or any other specific version you need).
- Install
pyenv
withbrew
to manage different python versions:brew install pyenv
- List all installable versions with
pyenv install --list
- Install python 2.7.18 with
pyenv install 2.7.18
- List installed versions with
pyenv versions
- Set global python version with
pyenv global 2.7.18
- Add
eval "$(pyenv init --path)"
to~/.zprofile
(or~/.bash_profile
or~/.zshrc
, whichever you need) - Relaunch the shell and check that python works.
Original Author Bernd Kampl Of This Content
Solution 2
OK, after a couple of days trying, this is what has worked for me:
- I reinstalled Monterey (not sure it was essential, but I just figured I had messed with terminal and
$PATH
too much). - I installed
python
viabrew
rather than from the official website.
It would still returncommand not found
error. - I ran
echo "alias python=/usr/bin/python3" >> ~/.zshrc
in terminal to aliaspython
withpython3
.
Problem solved.
As far as I get it, there is no more pre-installed python 2.x in macOS as of 12.3 hence the error. I still find it odd though that atom-python-run
would call for python
instead of python3
despite the settings.
Original Author Bernd Kampl Of This Content
Solution 3
If you simply installed python3 just use python3
as the command instead of just python
. In my case I had to install pynev
first via brew
using brew install pyenv
.
But still after using pynev to install python 2.7.18 and setting it as a global version using pyenv global 2.7.18
I still ran into an error while trying to run python
.
What worked for me (since I already had python3 installed) is by changing my command to use python3
instead of just python
. Of course, this won’t be a solution to everyone who may want to use python 2.
Original Author Alvin Wanjala Of This Content
Solution 4
I got zsh: Command not found python
after installing using https://www.python.org/ftp/python/3.10.4/python-3.10.4-macos11.pkg
I solved it by configuring the ENVIRONMENT. I added a line alias python=/usr/local/bin/python3.10
into the .zshrc
.(you must be sure it is the true path!)
My macOS (Apple Silicon):
Darwin Johns-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64
Original Author CheverJohn Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.