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?
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).
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