SoFunction
Updated on 2024-12-19

Detailed steps to add a Python interpreter inside VScode

VScode editor will automatically select the highest-ordered interpreter in the environment variable as the default interpreter after installing the Python plugin, and you will need to set up your own Python interpreter if you want to add a new one.

Pythoncap (a poem)VScode EditorInstallation in Windows systems

PythonExtension Plugin InstallationexistVScode Editor

The first step is to open the VScode editor, press the shortcut key "Ctrl+Shift+P" to bring up the Global Settings search window, which will be displayed at the top center of the entire editor window, and then type "Python:Select Interpreter", and a related option will appear.

The second step is to click on the "Python:Select Interpreter" option, and you will be automatically redirected to the Python Editor Configuration window at the same location, which will show the Python interpreters that are being used and those that have been added to the list that are ready to be used. To add a new Python interpreter, just click on the "+ Enter" option on the first line and you will be taken to the next window.

Step 3: In the new window, click on the "Find" option to open the file explorer and find the directory where you want to add the Python interpreter. Select it and click the "Select Interpreter" button to add the interpreter to the VScode editor. However, the newly added Python interpreter will not be set as the default interpreter, you need to reuse the shortcut key to open the global settings window, go to the "Select" interpreter selection page, click on the path of the interpreter, and then you can use it.

Step 4: Create the project and open it in VScode.

Determine if the Python 3.11.2 interpreter has been added to VScode:

1) First, create a new folder on the desktop and name it "aaaa";

2) In VScode, click "File", and select "Open Folder", add the new desktop "aaaa";

3) Add "aaaa" and click OK, and select "Yes, I trust the authors";

4) Click "New fiel..." in the added "aaaa" item to create the file;

5) Input the code "print('hello world')" in the created one, and click the Run button, you can get the result in the terminal.

After performing the above steps, you can see "Python" in the bottom right corner of VScode, indicating that the Python 3.11.2 interpreter has been added to VScode.

to this article about adding Python interpreter in VScode inside the article is introduced to this, more related to VScode to add Python interpreter content, please search for my previous articles or continue to browse the following related articles I hope you will support me in the future!