Cant run python code in vs code

every time i try to code using vs code in my m2 macbook air i get the following message in output , i am new to coding

/bin/sh: python: command not found

I am not a Macbook user but I believe that shit has other versions of python installed by default as well.
So may be using python3 can help!

Have you tried one of the following:

1: Try setup hot key for run python in terminal

  1. Installing Extension Code Runner

and using its Keybind after installing it “Ctrl+Alt+N”.

Also as @ maverick stated for Mac should be python3 as command.

and make sure that is detecting Python in the down right corner as language and code interpreter.


oh thanks for responding , well its written magic python in the right corner , i cant keybind it , how do i do it on a macbook? there is no Ctrl and Alt

You can bind it as you wish, you can use your Command key for the combination. just make sure to do not overwrite other keybind commands (if you do just remove the binding you’ve added).

I am not able to run a python code in Vs also I’m using windows 10…I have installed the correct extensions but when I write code brings this result to the output; .“Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.”"

Try python then the file name ie: python

I had to download…Thanks .

The error message “python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from settings” typically occurs when you try to run a Python script, but Windows is unable to locate the Python interpreter. To fix this, you can either install Python from the Microsoft Store by running it without any arguments (just type “python” in the command prompt and follow the installation prompts) or you can disable this specific shortcut in the Windows settings if you don’t intend to use it. Installing Python from the Microsoft Store ensures that the Python interpreter is readily available for running scripts and applications on your system.

Well, this error shows that the system is unable to locate the Python interpreter when you are trying to run your Python script in VS code.
Well, to fix this issue, you can add Python to path, and then after adding the path, restart your VS code and then final select the Python interpreter in VS code and then execute it.
I hope you will get a positive result after following the above process.