Set Python Environment For Visual Studio 2015 Community Edition

In this article we will discuss about how to set the working environment of PYTHON for Visual Studio, or you could say how to remove / troubleshoot the error called “We didn’t find any interpreters”.

I assume you installed Python through Visual Studio. All things are installed perfectly and now you that you are trying to create a new Python console project your code will not run/execute. 

This article shows you how to set the environment of Python in visual studio and execute the code.

You got this message:

"We didn't find any interpreters."

And this screen in Visual Studio,

Visual Studio

By default Visual Studio will not set the environment of Python. We have to set it manually.

Set by step implementation

Step 1

Visual Studio

After creating a project your solution explorer will look as follows,

Visual Studio

Step 2

Double click on StringPythonApplicaiton.py  and enter following lines of code:

  1. VisitorName = "Welcome to Python (Visual Studio)"  
  2. print(VisitorName+"\n\n")  

 

Visual Studio

The above Python code is very simple.

Line 1


A variable is created called “VisitorName” and stored value = “Welcome to Python (Visual Studio)”

Line 2

Display value of “VisitorName” on screen with the help of print command.

As you press the F5 key the following error appears:

Visual Studio

Step 3

Click on Solution explorer and follow the steps.

Visual Studio

After clicking on ADD / REMOVE PYTHON ENVIRONMENTS  you will see the following dialog box. By default Visual Studio created a New Environment 1

Visual Studio

Click OK now.

Step 4

Visual Studio
 
Visual Studio

In the above screen you can see OVERVIEW is selected by default now you have to click on dropdown list and select “CONFIGURE” option. See the below screen shot for the next step:

Visual Studio

Select CONFIGURE and the following text boxes appear on the screen

SR.NO.TEXTBOX TITLEREMARKS
1DescriptionGive your environment a name / title.  Example:MyPython
2PrefixPathMain folder of Python installer. Example: C:\Users\admin\AppData\Local\Programs\Python\Python36-32\
3Interpreter PathInterpreter path of Python Example: C:\Users\admin\AppData\Local\Programs\Python\Python36-32\python.exe
4Window Interpreter PathWindow Interpreter path of Python Example:C:\Users\admin\AppData\Local\Programs\Python\Python36-32\pythonw.exe
5Lib PathLibrary path of Python Example:C:\Users\admin\AppData\Local\Programs\Python\Python36-32\Lib

STEP 5 

Visual Studio
Visual Studio

STEP 6

Visual Studio

STEP 7 - Restart Visual Studio.

As you start again now click on solution explorer and expand PYTHON ENVIRONMENTS tab.

Your screen will look like the below screen shot.

Visual Studio

STEP 8

Now double click on “StringPythonApplication.py” file and press F5 to execute the code.

Visual Studio

Hope this article helped you and resolved your problem.


Similar Articles