Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code can't find Python

Suddenly, VS Code can't run any Python file. I get the following message:

bash: C:/Users/rapha/AppData/Local/Programs/Python/Python38/python.exe: No such file or directory

I have reinstalled Python and VS Code multiple times to add Python 3.8 properly to my Windows path, but I keep getting the same error. How can I fix it?

like image 451
Raphaël - Avatar asked Dec 17 '25 13:12

Raphaël -


1 Answers

In Visual Studio Code, open the Settings with (Ctrl + ,) then search settings for "Interpreter". There will be an option for "Python: Default Interpreter Path". Set the location of your python.exe file. Open a new Visual Studio Code terminal with (Ctrl + Shift + `) to test the Python command; you may need to restart Visual Studio Code.

I had trouble with Visual Studio Code being unable to locate Python even though I could run Python commands from any terminal opened from my computer (Windows Logo Key + cmd + Enter). I noticed that the Scripts folder was not installed on my Python installation, so I reinstalled Python and followed the above steps. It worked for me.

Visual Studio Code has a Python tutorial as well which includes a Select a Python Interpreter section (Getting Started with Python in VS Code).

like image 105
roomrys Avatar answered Dec 19 '25 02:12

roomrys



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!