- Установка поддержки Python в Visual Studio
- Скачать & рабочую нагрузку «Установка Python»
- Тестирование установки
- Дальнейшие действия
- Install Python support in Visual Studio
- Download & install the Python workload
- Test your install
- Next steps
- Install Python support in Visual Studio
- Download & install the Python workload
- Test your install
- Next steps
- Develop Python applications
- Libraries
- Find and install the libraries you need
- Debugging
- Interactively diagnose issues with your code on Windows and Linux
- Version Control integration
- Collaborate on code with Git
- Unit tests
- Validate your changes in the editor
- Open source
- Fork us on Github
- Visual Studio Community 2022
- Visual Studio Professional 2022
- Visual Studio Enterprise 2022
Установка поддержки Python в Visual Studio
Область применения:Visual Studio
Visual Studio для Mac
Visual Studio Code
Поддержка Python доступна только в Visual Studio для Windows. В Mac и Linux поддержка Python доступна через Visual Studio Code.
Скачать & рабочую нагрузку «Установка Python»
- Скачайте и запустите последнюю версию Visual Studio Installer для Windows. Поддержка Python доступна в выпуске 15.2 и выше. Если вы уже установили Visual Studio, откройте этот продукт и запустите установщик, выбрав Сервис>Получить средства и компоненты.
Совет Выпуск Community предназначен для индивидуальных разработчиков, использования при аудиторном обучении и в научных исследованиях, а также разработки решений с открытым кодом. Если программу планируется использовать в других целях, установите Visual Studio Professional или Visual Studio Enterprise.
Установщик предоставляет список рабочих нагрузок, которые представляют собой группы связанных параметров для конкретных областей разработки. Для Python выберите рабочую нагрузку Разработка на Python и нажмите Установить.
Параметры установки Python | Описание |
---|---|
Дистрибутивы Python | Выберите любое сочетание доступных дистрибутивов 32- и 64-разрядных версий Python 2, Python 3, Miniconda, Anaconda2 и Anaconda3, с которыми вы планируете работать. Каждый дистрибутив включает в себя интерпретатор, среду выполнения и библиотеки. В частности, Anaconda — это открытая платформа обработки и анализа данных, которая включает в себя множество предварительно установленных пакетов. Visual Studio автоматически определяет существующие установки Python. См. Окно «Окружения Python». Кроме того, если доступна более новая версия Python, чем показанная в установщике, то вы можете установить эту версию отдельно, и Visual Studio обнаружит ее. |
Поддержка шаблонов Cookiecutter | Устанавливает графический пользовательский интерфейс Cookiecutter для поиска шаблонов, ввода их параметров и создания проектов и файлов. См. раздел Использование расширения Cookiecutter. |
Поддержка веб-приложений Python | Устанавливает средства для разработки веб-приложений, включая поддержку редактирования кода HTML, CSS и JavaScript, а также шаблоны проектов на основе платформ Bottle, Flask и Django. См. статью Шаблоны веб-проектов Python. |
Встроенные средства разработки Python | Устанавливает компилятор C++ и другие компоненты, необходимые для разработки собственных расширений для Python. См. статью Создание расширения C++ для Python. Чтобы обеспечить полную поддержку С++, установите рабочую нагрузку Разработка классических приложений на C++ . |
По умолчанию рабочая нагрузка Python устанавливается для всех пользователей на компьютере в следующих разделах:
*%ProgramFiles%\Microsoft Visual Studio\\\\Common7\IDE\Extensions\Microsoft\Python*
*%ProgramFiles(x86)%\Microsoft Visual Studio\\\\Common7\IDE\Extensions\Microsoft\Python*
Тестирование установки
Чтобы быстро протестировать поддержку Python, выполните следующие действия.
- Запуск Visual Studio
- Нажмите клавишу ALT+I , чтобы открыть интерактивное окно Python , и введите 2+2 . Если вы не увидите результат 4, проверьте выполненные действия.
Дальнейшие действия
Install Python support in Visual Studio
Applies to: Visual Studio
Visual Studio for Mac
Visual 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
- 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.
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:
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\\\\Common7\IDE\Extensions\Microsoft\Python*
*%ProgramFiles(x86)%\Microsoft Visual Studio\\\\Common7\IDE\Extensions\Microsoft\Python*
Test your install
To quickly test Python support:
- Launch Visual Studio
- 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.
Next steps
Install Python support in Visual Studio
Applies to: Visual Studio
Visual Studio for Mac
Visual 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
- 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.
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:
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\\\\Common7\IDE\Extensions\Microsoft\Python*
*%ProgramFiles(x86)%\Microsoft Visual Studio\\\\Common7\IDE\Extensions\Microsoft\Python*
Test your install
To quickly test Python support:
- Launch Visual Studio
- 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.
Next steps
Develop Python applications
Let Visual Studio think about your code and tell you which types go where. Tooltips, completions and code snippets make you more productive.
Libraries
Find and install the libraries you need
Third-party libraries are the fastest way to solve your problems. Use our pip, PyPI and virtual environment support to manage your projects and dependencies.
Debugging
Interactively diagnose issues with your code on Windows and Linux
None of us write perfect code all the time, but when it goes wrong Visual Studio can help. Visually step through your code, view or modify state, and interact with your program regardless of the operating system.
Version Control integration
Collaborate on code with Git
Use Git as the default source control experience in Visual Studio right out of the box. From the new Git menu, you can create or clone repositories from GitHub or Azure DevOps. Use the integrated Git tool windows to commit and push changes to your code, manage branches, sync with your remote repositories, and resolve merge conflicts.
Unit tests
Validate your changes in the editor
Make sure your code is working correctly without leaving Visual Studio. View, edit, run, and debug unit test-style tests from the Test Window.
Open source
Fork us on Github
Python Tools for Visual Studio is a completely free extension, developed and supported by Microsoft with contributions from the community. Visit our Github page to see or participate in PTVS development.
Visual Studio Community 2022
Free, fully-featured IDE for students, open-source and individual developers
Visual Studio Professional 2022
Professional developer tools, services, and subscription benefits for small teams
Visual Studio Enterprise 2022
End-to-end solution to meet demanding quality and scale needs of teams of all sizes