vscode-code-runner icon indicating copy to clipboard operation
vscode-code-runner copied to clipboard

[Bug]The Python interpreter that CodeRunner uses to execute python code is always the global interpreter.

Open leij0318 opened this issue 2 years ago • 3 comments

I don't know why the Python interpreter that CodeRunner takes effect is always the global interpreter, not the default python interpreter set. The global interpreter I am talking about is the python interpreter with the word global at the end after opening the command panel in VScode and entering python. Now you can only specify the python interpreter path in "code-runner.executorMap" in setting.json.

The above situation I mentioned is that CodeRunner does not execute in the terminal by default. Of course, it will not be wrong if it is executed in the terminal, but my default terminal powershell is integrated in the windows terminal. When executing, I must first activate the current environment. Dislike the slow startup speed.

leij0318 avatar Nov 12 '23 04:11 leij0318

Can anyone tell me how to modify or cancel the python global interpreter?

leij0318 avatar Nov 12 '23 04:11 leij0318

Try putting the path to your Python executable in settings.json:

"code-runner.executorMap": {
    "python": "path-to-your-env-python-executable-here"
  }

For example, mine would be:

"code-runner.executorMap": {
    "python": "/home/user/anaconda3/envs/vsc/bin/python"
  }

RainyCityCoder avatar Dec 23 '23 00:12 RainyCityCoder

try this setting "code-runner.executorMap": { "python": "$pythonPath $fullFileName" }, "code-runner.respectShebang": false

jackyhevey avatar Apr 09 '24 16:04 jackyhevey