skip to Main Content

I was trying learning about logging in python for the first time today. I discovered when i tried running my code from VS Code, I received this error message

/bin/sh: 1: python: not found however when I run the code directly from my terminal, I get the expected result. I need help to figure out the reason for the error message when I run the code directly from VSCode.

3

Answers


  1. Python Interpreter to be set up. Many ways mentioned in the vs code documentation https://code.visualstudio.com/docs/python/environments, here easiest would be to open command palette and search for python interpreter and there you can enter the path of python/python3 installed.

    Login or Signup to reply.
  2. You can use shortcuts "Ctrl+Shift+P" and type "Python: Select Interperter" to choose the python interpreter.

    You can also click the button in the lower right.

    enter image description here

    Login or Signup to reply.
  3. The error message you are receiving indicates that the "python" executable is not found in the PATH environment variable of the terminal you are using from within Visual Studio Code.

    Add the location of the Python executable to the PATH environment variable in your terminal.

    Specify the full path to the Python executable in your Visual Studio Code terminal.

    You can find the full path to the Python executable by running the command "which python" in your terminal.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search