Install Python support in Visual Studio

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

Python support is available only on Visual Studio for Windows. On Mac and Linux, Python support is available through Visual Studio Code.

Download & install the Python workload

  1. Download and run the latest Visual Studio installer for Windows. Python support is present in the release 15.2 and later. If you have Visual Studio installed already, open Visual Studio and run the installer by selecting Tools > Get Tools and Features.

    Tip

    The Community edition is for individual developers, classroom learning, academic research, and open source development. For other uses, install Visual Studio Professional or Visual Studio Enterprise.

  2. The installer provides a list of workloads that are groups of related options for specific development areas. For Python, select the Python development workload and select Install:

    Screenshot of the Python development workload selected in the Visual Studio installer.

    Python installation options Description
    Python distributions Choose any combination of the available options, such as 32-bit and 64-bit variants of the Python 2, Python 3, Miniconda, Anaconda2, and Anaconda3 distributions that you plan to work with. Each includes the distribution's interpreter, runtime, and libraries. Anaconda, specifically, is an open data science platform that includes a wide range of pre-installed packages. Visual Studio automatically detects existing Python installations. See The Python Environments window. Also, if a newer version of Python is available than what's shown in the installer, you can install that version separately and Visual Studio will detect it.
    Cookiecutter template support Installs the Cookiecutter graphical UI to discover templates, input template options, and create projects and files. See Use the Cookiecutter extension.
    Python web support Installs tools for web development including HTML, CSS, and JavaScript editing support, along with templates for projects using the Bottle, Flask, and Django frameworks. See Python web project templates.
    Python native development tools Installs the C++ compiler and other necessary components to develop native extensions for Python. See Create a C++ extension for Python. Also install the Desktop development with C++ workload for full C++ support.

    By default, the Python workload gets installed for all users on a computer under:

    *%ProgramFiles%\Microsoft Visual Studio\\<VS_version>\\<VS_edition>Common7\IDE\Extensions\Microsoft\Python*
    

    where <VS_version> is 2022 and <VS_edition> is Community, Professional, or Enterprise.

    *%ProgramFiles(x86)%\Microsoft Visual Studio\\<VS_version>\\<VS_edition>Common7\IDE\Extensions\Microsoft\Python*
    

    where <VS_version> is 2019 or 2017 and <VS_edition> is Community, Professional, or Enterprise.

Test your install

To quickly test Python support:

  1. Launch Visual Studio

  2. Press Alt+I to open the Python Interactive window and enter 2+2. If you don't see the output of 4, recheck your steps.

    Screenshot of testing Python through the interactive window.

    Screenshot of testing Python through the Visual Studio 2022 interactive window.