After installing VSCode
(I already have python 2.7
on my machine), I tried to run a simple script on Windows 10 and got this error:
[Running] /usr/bin/env python "c:\Users\jim\Dropbox\projects\python\myproject\main.py" The system cannot find the path specified.
So I tried to edit these settings:
And also these:
but I'm still getting this error.
It looks like you're using the Code Runner extension to run your code, and it's doing /usr/bin/env python
instead of just python
. Go into your User Settings and add the following:
"code-runner.executorMap": {
"python": "python",
}
Also double-check that your python script doesn't start with the shebang #!/usr/bin/env python
, as that could also be causing the behaviour you're experiencing.
EDIT: Turns out there's a code-runner.respectShebang
setting for the Code Runner extension that defaults to true
, but can be set to false to allow you to keep the shebang in the script but not use it when running the code via Code Runner:
{
"code-runner.respectShebang": false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With