Hi, I’m a beginner in learning python and just installed vscode in my m1 MacBook Air.
after installing code runner extension and creating a short python print command sample and pressing run code OUTPUT it says " //bin/sh: python: command not found
[Done] exited with code=127 in 0.006 seconds "
HELP PLEASE!!!
Hello SyntaxError, it looks to me like you forgot to install
python
on your MacBook Air. Here are some generic instructions for installing Python on Mac:
5. Using Python on a Mac — Python 3.10.5 documentation
Alternatively, it is possible that VSCode is looking for the
python
binary in the wrong place. Here are the instructions for running Python in VSCode:
Get Started Tutorial for Python in Visual Studio Code
I got it working installing python 3 using homebrew I don’t know what’s happening just new in using apple Macbook so I don’t know this things . I believe I already installed python 3.10.5 in it which is not working but Homebrew installed python3.9.13 instead. Any idea about this or what is happening?
Possibly this:
The system install of Python on macOS is not supported. Instead, an installation through
Homebrew
is recommended. To install Python using Homebrew on macOS use
brew install python3
at the Terminal prompt.
Get Started Tutorial for Python in Visual Studio Code
Yeah i think I’ll just use the 3.9 version , I couldn’t install the 3.10.5 there’s a guide on it but i don’t know how to follow it it’s a hard for me at this time need more experience on using mac os.
Thanks you jmrunkle!
Did you follow the tutorials linked up here:
/bin/sh: python: command not found - #2 by jmrunkle
If so, do you get any output when you type
python
or
python3
in a terminal?
Hi Eozcode sorry i stop my python coding for awhile and i forgot how i did it. Try researching it on youtube. I was stuck for two days searching for it and There was a lot of websites. The one thing that I remember was about homebrew, try to start there. When I remember everything I’ll let know. Good luck
Yes, I followed the guide and did many times with and without homebrew also following many youtube guide with different settings but still the same error. If I run code on terminal it works but when I use code runner then it shows the error so I figured it must be the extension that is causing trouble.
Did you select the right python interpreter?
Get Started Tutorial for Python in Visual Studio Code
If you have python installed correctly, it seems likely that VSCode is just looking for it in the wrong place.
Ok, maybe it is time for some screenshots and output summaries. Can we get:
Screenshot(s) of what it looks like when you try to run your python file (ie, what buttons you click on, what interpreter is selected, etc).
What extensions do you have installed on VSCode?
Paste (or screenshot) of the python extension’s settings.
In the worse case scenario, you should be able to get by just running Python in the terminal (using
python somefile
to run the code in
somefile
). It is not that bad to get used to running commands in the terminal anyway.