zsh: killed python3 on M1 MacBook Pro

Viewed 13078

I'm trying to run Python 3 on the new M1 chip MacBook. I tried installing python3 both via the official Python website (https://www.python.org/downloads/release/python-391/) and also via brew install python3. Both of the installations succeeded, however when I try running the command python3 in Terminal I get this error:

zsh: killed     python3

Does anyone know what's going on? I couldn't find anything online and I think my installation should be fine. I did have to change my ~/.zshrc file for a class, but I'm not sure if that's the issue?

4 Answers

I faced this same issue in the M1 Macbook pro and fixed it by doing the following

Open ~/.zshrc file (Create a new one if not present already) Add the following line

alias python3="/usr/bin/python3"

Make sure you are able to access python3 from the above location by running

/usr/bin/python3

This should invoke Python3 for you or check for the correct path in /usr/bin and update the above line accordingly. You can do the same for other versions of Python also accordingly.

Try reinstalling python and all dependencies using homebrew!

brew reinstall $(brew deps python3) python3

I started to face the same issue myself while on M1 chip MacBook with macOS Monterey. I was using VS code to try to run my python script and it worked fine. But when I tried it on the terminal I kept getting that same response.

The simple solution that I found to work was specifying which python version I was running. Ex: say I have a file named testing.py and I am running the latest version of python 3.X, then in my terminal I would do

python3.X testing.py

and everything seemed to run just fine (at least for me).

Enjoy

I got a same error. Then I disabled MacOS System Integrity Protection(SIP), python3 runs correctly.

Related