Python компилятор для windows

User

Even though Python is an interpreted language, you may need to install Windows C++ compilers in some cases. Unlike Linux, compilers for Windows are not included by default in the OS.

  • Install a non-pure Python package from sources with Pip (if there is no Wheel package provided).
  • Compile a Cython or Pyrex file.

Microsoft provides official C++ compilers called Visual C++, you can find them bundled with Visual Studio or, for some versions, in standalone distributions. Some alternative compilers exist like MinGW, but incompatibilities may occur with a CPython official distribution that is built with Microsoft Visual C++.

The compiler’s architecture must be the same as Python’s (for example: if you use Python 64bit, you have to use an x64 compiler).

Which Microsoft Visual C++ compiler to use with a specific Python version ?

Each Python version uses a specific compiler version (e.g. CPython 2.7 uses Visual C++ 9.0, CPython 3.3 uses Visual C++ 10.0, etc). So, you need to install the compiler version that corresponds to your Python version :

Please also have a look at The Python Dev Guide for Windows to check for additional requirements or updates to the above table.

Distutils notes

  • distutils only supports the very minimum of compiler setups. The sections in this guide corresponding to them explicitly mention distutils.
  • For other setups, you need to run the compilation from the «SDK prompt» of the corresponding toolchain and set the DISTUTILS_USE_SDK environment variable to a non-empty value.

Compilers Installation and configuration

Compatible architectures are specified for each compiler in brackets.

Before do anything, install or upgrade the Setuptools Python package. It contain compatibility improvements and add automatic use of compilers:

pip install --upgrade setuptools

Microsoft Visual C++ 14.x with Visual Studio 2022 (x86, x64, ARM, ARM64)

  • Install Microsoft Visual Studio 2022 (or later).
  • Install the Python development workload and the optional Python native development tools option.
  • Install the latest Windows SDK (under Native development in the installer).
  • Optional: Set $env:PlatformToolset to your toolset version before building, if it doesn’t detect it.
  • Update to the latest setuptools Python package version.

For additional details, please have a look at the Windows section of the Python Development Guide and the PCbuild/python.props file for full details on how Python is built on Windows.

Читайте также:  Какова структура html страницы

At the time of this writing, CPython is built using VC++ 14.3 (Jan 2022).

Microsoft Visual C++ 14.2 standalone: Build Tools for Visual Studio 2019 (x86, x64, ARM, ARM64)

  • Install Microsoft Build Tools for Visual Studio 2019.
  • In Build tools, install C++ build tools and ensure the latest versions of MSVCv142 — VS 2019 C++ x64/x86 build tools and Windows 10 SDK are checked.
  • The setuptools Python package version must be at least 34.4.0.

<i data-lazy-src=

Microsoft Visual C++ 10.0 with Visual Studio 2010 (x86, x64, ia64)

Visual Studio 2010 contains Visual C++ 10.0 compiler. Distutils will automatically detect the compiler and use it. The Express edition of Visual Studio 2010 only bundles a compiler for x86.

Microsoft Visual C++ 9.0 standalone: Visual C++ Compiler for Python 2.7 (x86, x64)

<i data-lazy-src=

GCC — MinGW-w64 (x86, x64)

  • Install Win-builds into C:\MinGW_w64.
  • Open Win-builds, switch to install at least binutils, gcc, gcc-g++, getext, mingw-w64, win-iconv, winpthreads, zlib, and click Process.
  • Add C:\MinGW_w64\bin to the PATH environment variable.
  • Create a distutils.cfg file with the following contents in the folder \Lib\distutils in Python install directory :
 1  [build]  2  compiler=mingw32  3    4  [build_ext]  5  compiler=mingw32 

GCC — MinGW (x86)

  • Install Minimalist GNU For Windows into C:\MinGW.
  • Open MinGW Installation Manager, check mingw32-base and mingw32-gcc-g++, and Apply Changes in the Installation menu.
  • Add C:\MinGW\bin to the PATH environment variable.
  • Create a distutils.cfg file with the following contents in the folder \Lib\distutils in Python install directory :
 1  [build]  2  compiler=mingw32  3    4  [build_ext]  5  compiler=mingw32 

WindowsCompilers (last edited 2023-06-09 12:03:05 by MarcAndreLemburg )

5 лучших IDE для Python и не только

Если вы сюда зашли, то, возможно, вы ищете IDE для Python.

В этой статье мы пройдёмся по пяти лучшим по моему мнению IDE.

1. Atom

Этот простой на первый взгляд редактор, на самом деле обладает огромным функционалом. Atom написан разработчиками GitHub`а с использованием Electron — фреймворка для создания кроссплатформенных приложений для десктопа средствами JavaScript, HTML и CSS — и имеет множество расширений.

Плюсы:

  • Гибкая кастомизация
  • Удобный и понятный интерфейс
  • Поддержка множества языков программирования
  • Простая и понятная установка

Минусы:

  • Нет встроенного компилятора и экрана отладки, их нужно добавлять с помощью расширений

2.Microsoft Visual Studio

Microsotf Visual Studio, как её ещё называют «VS» является полнофункциональным IDE, с не менее красивым дизайном, чем Atom. Она имеет две версии для скачивания: Бесплатная (Community) и платная (Professional и Enterprise).

Плюсы:

Минусы:

  • Может быть установлен только на платформу Windows

3. PyCharm

PyCharm разработан компанией JetBrains и предназначен только для Python. После запуска вы сразу можете начать писать код. Существует бесплатная (Commynity) версия и платная(Professional) версия. Вторая же обладает более гибким функционалом. IDE доступен для MAC, Windows и Linux.

Плюсы:

  • Встроенный компилятор и экран отладки
  • Приятный и красивый дизайн
  • Возможность писать код сразу после запуска

Минусы:

  • Возможные сбои встроенного компилятора

4.Spyder

Spyder это тоже хороший вариант IDE для разработчиков, работающих с Python. Это легкая в использовании и интуитивно понятная среда разработки.

Плюсы:

Минусы:

  • Возможные сбои

5.Sublime Text

Небольшое по функционалу IDE с большой фанатской базой, которое по сей день хорошо поддерживается. Эта среда работает с несколькими языками программирования. Сама программа частично платная. То есть за неё нужно платить, но можно воспользоваться демо-версией.

Плюсы:

Минусы:

  • Малый функционал

В заключение хочу сказать, что выбор среды разработки — чистая вкусовщина. Спасибо за внимание, надеюсь, вы нашли то, что искали.

Источник

Оцените статью