I am really new to Python and just started the course "Python 3 basics by Sendtex (Link: https://www.youtube.com/channel/UCfzlCWGWYyIQ0aLC5w48gBQ)".
However, I am not able to get any output. Below is the attached screenshot.
If I select Python it enters debugging mode. So, there isn't any output.
If the installation was successful, the output window should show the version of Python that you installed. Note You can use the py -0 command in the VS Code integrated terminal to view the versions of python installed on your machine.
Go to the VS Code preferences, and under interpreter, you'll find Interpreter Path , so set that to the path of your python installation, restart VS Code, and you should be good.
Select and activate an environment By default, the Python extension looks for and uses the first Python interpreter it finds in the system path. To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).
I recommend reviewing the official Visual Studio Code Python documentation and tutorial. That provides several of the basics, with running and debugging the "official" way.
There are multiple ways to configure built-in launches:
You can run or debug using an icon and dropdown in the upper right of your editor window, when editing a python script file.
You may need to setup a run/debug configuration to use this (see below), or it may automatically step you through creating one.
The output will normally go to a new "Python" terminal in the "terminal" window (Ctrl-` to open it). See this answer for how to change that behavior.
Run/Add Configuration
, and follow the prompts at the top of the VS Code window.Updated Image (1/2022) - Changed from just 'Debug' to 'Run and Debug':
Now your debug configuration box on the top left of the debug pane should say "Python: Current File":
Visual Studio Code will add a file to your current workspace or working folder called .vscode/launch.json
, and opened it for edit.
During installation if you forget to tick in check box for path
and then if you are running any python file on visual studio it will not return any output
untill and unless you have not added it into visual studio code
.
First of all go to File
→ Preference
→ Settings.json
"code-runner.executorMap":
{
"python": "\"C:\\Program Files\\Python39\\python.exe\""
I have attached the screenshot for your better understanding!
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