Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

Install Python support in Visual Studio

  • 2024-09-13
Feedback

In this article

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

Prerequisites

Note

You also need a Python interpreter installed in order to work with Python in Visual Studio. We recommend installing one frompython.org or Anaconda. For more information on Python interpreters, seeInstalling Python Interpreters.

Download and install the Python workload

Complete the following steps to download and install the Python workload.

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

    Tip

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

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

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

    Python installation optionsDescription
    Python distributionsChoose any combination of Python distribution that you plan to work with. Common options include 32-bit and 64-bit variants of Python 2, Python 3, Miniconda, Anaconda 2, and Anaconda 3. Each option includes the distribution's interpreter, runtime, and libraries. Anaconda, specifically, is an open data science platform that includes a wide range of preinstalled packages. Visual Studio automatically detects existing Python installations. For more information, seeThe Python Environments window. Also, if a newer version of Python is available than the version shown in the installer, you can install the new version separately and Visual Studio detects it.
    Cookiecutter template supportInstall the Cookiecutter graphical UI to discover templates, input template options, and create projects and files. For more information, seeUse the Cookiecutter extension.
    Python web supportInstall tools for web development including HTML, CSS, and JavaScript editing support, along with templates for projects using the Bottle, Flask, and Django frameworks. For more information, seePython web project templates.
    Python native development toolsInstall the C++ compiler and other necessary components to develop native extensions for Python. For more information, seeCreate a C++ extension for Python. Also install theDesktop development with C++ workload for full C++ support.

    By default, the Python workload installs 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

Quickly check your installation of Python support:

  1. Launch Visual Studio.

  2. Select Alt + I to open thePython Interactive window.

  3. In the window, enter the statement2+2.

    The statement output4 displays in the window. If you don't see the correct output, recheck your steps.

    Screenshot that shows a test of Python support through the interactive window.

    Screenshot that shows a test of Python support through the Visual Studio 2022 interactive window.

Related content


Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo