How to change interpreter in Visual Studio Code?
Solution 1
All you have to do is press ctrl+shift+p Then will get a search bar kinda thing on top of the screen.
Then type the following command:
> python: select interpreter
You will be provided with options. Select the one you want to use.
Solution 2
At the bottom of the MS Code screen is an info bar that lets you know what line, col, text encoding, etc... It also shows the python interpreter you are accessing.
If you click on the text for the version of python that is running, it will open a list of available interpreters on your system. If 2.7 is in your path, you can select it.
Solution 3
Download and install the python version that you want https://www.python.org/downloads/
Open the visual studio code
Click on the Bottom left for the version
Comments
-
ban.85 almost 2 years
I have installed on my system several Python interpreters, 2.x and 3.x versions. I am trying to prepare my work environment to allow easily switch between code written in both Python version. It is really important to have as much flexible setting in Visual Studio Code (VSC). The problem is that I have no idea how to set VSC terminal to run code in Python 2.x. Terminal output is needed because it allows to provide user input easily. I've tried instructions provided on VSC page, like manual interpreter's path indication in folder or workspace setting. I reinstalled Python 2.x to ensure PATH variable has been updated. When I run code with CodeRunner extension, it always run it in Python 3.x. Does anyone have similar issue and found how to change Python environment used by this integrated terminal?
-
ban.85 over 6 yearsSeems that it is needed to manually change the PATH variable. Re-installation of interpreter may not change it, even if user is sets this in installation setup. After manual PATH edition, terminals uses correct interpreter.
-
ban.85 over 6 yearsAlso, when using workspaces and folders ensure that appropriate "python.exe" is indicated in respective settings.
-
-
Vincent almost 5 yearsI had this option but it was recently removed. Do you know how I can readd it?
-
maugch over 4 yearsIt won't change the interpreter used by the integrated terminal
-
maugch over 4 yearsIt won't change the interpreter used by the integrated terminal though.
-
Travis Heeter about 2 yearsIt looks like they removed this functionality. Now you have to do it via the Command Palette: Ctrl+Shift+P > Search for Interpreter >
python:select interpreter