Sitelet https://github.com/BorisRadovanovic/visualstudio-docs/blob/master/docs/python/installation.md
Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 5.71 KB

File metadata and controls

103 lines (69 loc) · 5.71 KB
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
devlang-python
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

Installing Python support in Visual Studio on Windows

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.

Visual Studio 2017

  1. Install the Visual Studio 2017 from https://www.visualstudio.com/vs/.

  2. In the Visual Studio installer, select the Web & Cloud > Python Development workload.

    Python development workload in the Visual Studio installer

    [!Note] Python is also included in the Data science and analytical applications workload.

  3. 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.

    Python development options in the Visual Studio installer

  4. If you already have interpreters installed on your computer, see Creating an environment for an existing interpreter.

Visual Studio 2015

  1. Run the Visual Studio installer through Control Panel > Programs and Features, selecting Microsoft Visual Studio 2015 and then Change.

  2. In the installer, select Modify.

  3. Select Programming Languages > Python Tools for Visual Studio and then Next:

    PTVS option in Visual Studio 2015 installer

  4. 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

  1. Install the appropriate version of Python Tools for Visual Studio for your version of Visual Studio:

  2. Install a Python interpreter of your choice. If you already have an interpreter installed, see Creating an environment for an existing interpreter.

Install locations

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
  • 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

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.

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.