Installing Python support in Visual Studio on Windows
To install Python support for Visual Studio (also known as Python Tools for Visual Studio or PTVS), follow the instructions in the section that matches your version of Visual Studio:
For Visual Studio 2015 and earlier you also need to separately install a Python interpreter of your choice (Python 3.5 and earlier; 3.6 is not supported and will generate the message "Unsupported Python version 3.6"). For details, see Python environments. The same page also contains instructions for adding an existing Python interpreter to Visual Studio 2017.
To quickly test Python support after following the installation steps, Open the Python Interactive window by pressing Alt-I and entering
2+2. If you don't see the output of
4, recheck your steps.
The Python workload includes the helpful Cookiecutter extension that provides a graphical user interface to discover templates, input template options, and create projects and files. For details, see Using Cookiecutter.
Python support is not presently available in Visual Studio for Mac, but is available on Mac and Linux through Visual Studio Code. See questions and answers.
Visual Studio 2017
Download and run the latest Visual Studio 2017 installer. You must install version 15.2 and above to use Python.
The installer presents you with a list of workloads, which are groups of related options for specific development areas. For Python, select the Python development workload.
Optional: if you're working with data science, also consider the Data science and analytical applications workload (Visual Studio 2017 15.2 and later). This workload includes support for Python as well as the R and F# languages. For more information, see Data science and analytical applications workload.
On the right side of the installer, chose additional options if desired. Skip this step to accept the default options.
After installation, the installer provides options to modify, launch, repair, or uninstall Visual Studio. The Modify button changes to Update when updates to Visual Studio when updates are available for any installed components. (The modify option is then available on the drop-down menu.) You can also launch Visual Studio and the installer from the Windows Start menu by searching on "Visual Studio".
Visual Studio 2015
Run the Visual Studio installer through Control Panel > Programs and Features, selecting Microsoft Visual Studio 2015 and then Change.
In the installer, select Modify.
Select Programming Languages > Python Tools for Visual Studio and then Next:
Once Visual Studio setup is complete, install a Python interpreter of your choice. If you already have an interpreter installed, see Creating an environment for an existing interpreter.
Visual Studio 2013 and earlier
Install the appropriate version of Python Tools for Visual Studio for your version of Visual Studio:
Install a Python interpreter of your choice. If you already have an interpreter installed, see Creating an environment for an existing interpreter.
By default, Python support is installed for all users on a computer.
For Visual Studio 2017, the Python workload is installed in
%ProgramFiles(x86)%\Microsoft Visual Studio\2017\<VS_edition>Common7\IDE\Extensions\Microsoft\Python where <VS_edition> is Community, Professional, or Enterprise.
For Visual Studio 2015 and earlier, installation paths are as follows:
%Program Files(x86)%\Microsoft Visual Studio <VS_ver>\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\<PTVS_ver>
- Registry location of path:
%Program Files%\Microsoft Visual Studio <VS_ver>\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\<PTVS_ver>
- Registry location of path:
- <VS_ver> is:
- 14.0 for Visual Studio 2015
- 12.0 for Visual Studio 2013
- 11.0 for Visual Studio 2012
- 10.0 for Visual Studio 2010
- <PTVS_ver> is a version number, such as 2.2, 2.1, 2.0, 1.5, 1.1, or 1.0.
User-specific installations (1.5 and earlier)
Python Tools for Visual Studio 1.5 and earlier allowed installation for the current user only, in which case the installation path is
%LocalAppData%\Microsoft\VisualStudio\<VS_ver>\Extensions\Microsoft\Python Tools for Visual Studio\<PTVS_ver> where <VS_ver> and <PTVS_ver> are the same as described above.