Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

13.6K
Visualizações
How to fix "zsh: command not found: python" error? (macOS Monterey 12.3, python 3.10, Atom IDE, atom-python-run 0.9.7)

Since I got Monterey 12.3 update (not sure it's related though), I have been getting this error when I try to run my python code in the terminal: python not found error

I am using python 3.10.3, Atom IDE, and run the code in terminal via atom-python-run package (which used to work perfectly fine). The settings for the package go like this: atom-python-run-settings

The which command in terminal returns the following (which is odd because earlier it would return something to just which python): which python

I gather the error occurs because the terminal calls for python instead of python3, but I am super new to any coding and have no idea why it started now and how to fix it. Nothing of these has worked for me:

  • I deleted and then reinstalled python from python.org.
  • I tried alias python='python3' (which I saw in one of the threads here).
  • I tried export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" (which I found here).
  • To reset zsh and paths, I deleted all associated hidden files in /local/users/ and ran the terminal once again.
  • I deleted evetyrhing and reinstalled macos and python only to get the same error.
over 4 years ago · Santiago Trujillo
4 Respostas
Responde à pergunta

0

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).

  1. Install pyenv with brew to manage different python versions: brew install pyenv
  2. List all installable versions with pyenv install --list
  3. Install python 2.7.18 with pyenv install 2.7.18
  4. List installed versions with pyenv versions
  5. Set global python version with pyenv global 2.7.18
  6. Add eval "$(pyenv init --path)" to ~/.zprofile (or ~/.bash_profile or ~/.zshrc, whichever you need)
  7. Relaunch the shell and check that python works.
over 4 years ago · Santiago Trujillo Relatório

0

OK, after a couple of days trying, this is what has worked for me:

  1. I reinstalled Monterey (not sure it was essential, but I just figured I had messed with terminal and $PATH too much).
  2. I installed python via brew rather than from the official website. It would still return command not found error.
  3. I ran echo "alias python=/usr/bin/python3" >> ~/.zshrc in terminal to alias python with python3.

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.

over 4 years ago · Santiago Trujillo Relatório

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

Starting with macOS Monterey 12.3, Apple removed Python 2 from the system, so many programs that ran python stopped working. If you have Python 3 installed, try running:

 python3 --version

and use python3 archivo.py instead of python archivo.py .

If the atom-python-run plugin keeps trying to use python , check its configuration to point to python3 or the full path to the executable ( which python3 ).

3 months ago · Ruben Alexander Serrano Porras Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda