Reputation: 171
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.
Upvotes: 4
Views: 19552
Reputation: 11
I just modified "code-runner.respectShebang": false
, and it's worked for me.
Upvotes: 1
Reputation: 8262
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
}
Upvotes: 24