Compile Python2.7 source code in Windows and Python 2.7 source code.
This article begins with a series of articles and provides a deep understanding of the Python source code. It is a long-term task to read the reading notes in the book "Python source code analysis. There are three parts in total: Python object model, Python virtual machine, Python module dynamic loading and memory management.
Python version: Python-2.7.10
Compilation tool: Microsoft Visual Studio 2013
The Python version and VS version are relatively matched. Higher Python versions do not match higher VS versions. You may need to modify some source code and set various compilation options, therefore, this series does not use higher Python and VS versions.
Preparation
Download Python-2.7.10 source code from the Python Official Website
The decompressed directory is the content in the Python-2.7.10 directory:
Compile
-
- (1) decompress Python-2.7.10
(2) enter the Pcbuild folder, use vs 2013 to open pybuild. sln (vs solution), and enter the vs 2013 IDE environment.
(3) Right-click the Python project and select Set as StartUp Porject.
- (4) Right-click solution-> Properties
Configuration in the upper left corner: Release Debug (similar to Release)
- Project context: select only python/pythoncore
- (5)
First, compile make_buildinfo and make_versioninfo.
Right-click make_buildinfo, and choose make_versioninfo future. Only the project region is used for re-generation.
- (6) Compile the solution and generate the python_d.exe and python27_d.dll files in the PCbuild folder. You can double-click python_d.exe to enter the python command line environment.