formulahendry / vscode-code-runner

Code Runner for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
MIT License
2.2k stars 294 forks source link

Can't use python3 #366

Closed monsieurludo closed 6 years ago

monsieurludo commented 6 years ago

I've followed all recommendations and questions asked around and have downloaded the latest version of vs but when I set python to use python3 instead of 2 it just doesn't work. My config:

{
    "python.jediEnabled": false,
    "python.pythonPath": "/usr/local/bin/python3",
    "workbench.colorTheme": "Solarized Light",
    "code-runner.runInTerminal": true,
    "code-runner.defaultLanguage": "python",
    "code-runner.clearPreviousOutput": true
}

Doing

"code-runner.executorMap":
{
"python": "python3"
}

isn't working. Any help please?

FooKii commented 6 years ago

hey there, i think u can try simply add "code-runner.executorMap.python": "python3 -u" to the user settings and it should work. cheers!

formulahendry commented 6 years ago

@creeptonik , did you have Shebang for your python file?

monsieurludo commented 6 years ago

hey there, i think u can try simply add "code-runner.executorMap.python": "python3 -u" to the user settings and it should work. cheers!

It says "Unknown configuration setting"

settings json pythontools 2018-09-21 09-41-05

@formulahendry Shebang? Not sure...

formulahendry commented 6 years ago

@creeptonik , could you have a screenshot of your output and your python file?

monsieurludo commented 6 years ago

Here you go, it's the same error as if I was running python 2 ('No module named requests'): ft_get_write_video py pythontools 2018-09-21 11-44-14

formulahendry commented 6 years ago

Please set code-runner.respectShebang as false

Davincible commented 5 years ago

The above suggestion also fixed my issue, would be nice if python 3 was enabled by default, as python 2 will be unsupported soon anyways

WanerZhang commented 2 years ago

Please set code-runner.respectShebang as false

Hello, this still doesn't work for me, do you have any ideas? Thanks!

截屏2022-01-06 下午8 00 34
callmekofi commented 2 years ago

Python: Select Interpreter menu. Look for " Python X.X.X " on the bottom left of your screen. Look for "Python X.X.X". This is the currently detected/configured version of Python in your project, and clicking it brings you to the interpreter menu to change the Python version you're using check here