| title | Installation for Python in Visual Studio | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 7/13/2017 | |
| ms.prod | visual-studio-dev15 | |
| ms.reviewer | ||
| ms.suite | ||
| ms.technology |
|
|
| ms.devlang | python | |
| ms.tgt_pltfrm | ||
| ms.topic | article | |
| ms.assetid | ce3d3656-7ba2-490d-92df-0bb3e3badf92 | |
| caps.latest.revision | 11 | |
| author | kraigb | |
| ms.author | kraigb | |
| manager | ghogen |
To install Python support for Visual Studio, 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). 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.
Tip
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.
Note
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.
-
Install the Visual Studio 2017 from https://www.visualstudio.com/vs/.
-
In the Visual Studio installer, select the Web & Cloud > Python Development workload.
[!Note] Python is also included in the Data science and analytical applications workload.
-
On the right side of the installer, select the Python interpreters and other related tools you want to include. For example, if you plan on developing C++ extensions for Python, include the Python native development tools option.
-
If you already have interpreters installed on your computer, see Creating an environment for an existing interpreter.
-
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.
-
Install the appropriate version of Python Tools for Visual Studio for your version of Visual Studio:
- Visual Studio 2013: PTVS 2.2 for Visual Studio 2013. The File > New Project dialog in Visual Studio 2013 gives you a shortcut for this process.
- Visual Studio 2012: PTVS 2.1 for Visual Studio 2012
- Visual Studio 2010: PTVS 2.1 for Visual Studio 2010
-
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:
- 32-bit:
- Path:
%Program Files(x86)%\Microsoft Visual Studio <VS_ver>\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\<PTVS_ver> - Registry location of path:
HKEY_LOCAL_MACHINE\Software\Microsoft\PythonTools\<VS_ver>\InstallDir
- Path:
- 64-bit:
- Path:
%Program Files%\Microsoft Visual Studio <VS_ver>\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\<PTVS_ver> - Registry location of path:
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\PythonTools\<VS_ver>\InstallDir
- Path:
where:
- <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.
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.


