Python in Visual Studio

Python in Visual Studio

Visual Studio 2017 supports Python development.

To include Python support in Visual Studio 2017, select the Python development component by running VS2017 installer, as shown below.

Add Python in Visual Studio 2017

Once installed, you can now see the different templates for web or machine learning applications. Go to menu File ->New -> Project and you will see the Python related templates, as shown below.

Python Templates in Visual Studio 2017

Let's create a Python web project by selecting a web project template.

Create Python Web Project in Visual Studio

This will create an empty web project, as shown below.

Python Web Project

You can now add a new Python file, class, module, and packages by right clicking on the project in the solution explorer -> Add -> New Item..

Add Python Files

Select Empty Python File from the Add New Item dialog box and click Add. This will add an empty .py file to your project.

Run the Python interactive shell from Debug -> Execute Project in Python Interactive

Execute Python Shell in Visual Studio
Execute Python Shell in Visual Studio

Thus, you can use Visual Studio 2017 for Python development.