- Notifications
You must be signed in to change notification settings - Fork0
The Python programming language
License
abidart/cpython
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Copyright (c) 2001-2022 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
Contents
- Website:https://www.python.org
- Source code:https://github.com/python/cpython
- Issue tracker:https://bugs.python.org
- Documentation:https://docs.python.org
- Developer's Guide:https://devguide.python.org/
For more complete instructions on contributing to CPython development,see theDeveloper Guide.
Installable Python kits, and information about using Python, are available atpython.org.
On Unix, Linux, BSD, macOS, and Cygwin:
./configuremakemake testsudo make install
This will install Python aspython3
.
You can pass many options to the configure script; run./configure --help
to find out more. On macOS case-insensitive file systems and on Cygwin,the executable is calledpython.exe
; elsewhere it's justpython
.
Building a complete Python installation requires the use of variousadditional third-party libraries, depending on your build platform andconfigure options. Not all standard library modules are buildable oruseable on all platforms. Refer to theInstall dependenciessection of theDeveloper Guide for current detailed information ondependencies for various Linux distributions and macOS.
On macOS, there are additional configure and build options relatedto macOS framework and universal builds. Refer toMac/README.rst.
On Windows, seePCbuild/readme.txt.
If you wish, you can create a subdirectory and invoke configure from there.For example:
mkdir debugcd debug../configure --with-pydebugmakemake test
(This will fail if youalso built at the top-level directory. You should doamake clean
at the top-level first.)
To get an optimized build of Python,configure --enable-optimizations
before you runmake
. This sets the default make targets up to enableProfile Guided Optimization (PGO) and may be used to auto-enable Link TimeOptimization (LTO) on some platforms. For more details, see the sectionsbelow.
PGO takes advantage of recent versions of the GCC or Clang compilers. If used,either viaconfigure --enable-optimizations
or by manually runningmake profile-opt
regardless of configure flags, the optimized buildprocess will perform the following steps:
The entire Python directory is cleaned of temporary files that may haveresulted from a previous compilation.
An instrumented version of the interpreter is built, using suitable compilerflags for each flavor. Note that this is just an intermediary step. Thebinary resulting from this step is not good for real-life workloads as it hasprofiling instructions embedded inside.
After the instrumented interpreter is built, the Makefile will run a trainingworkload. This is necessary in order to profile the interpreter's execution.Note also that any output, both stdout and stderr, that may appear at this stepis suppressed.
The final step is to build the actual interpreter, using the informationcollected from the instrumented one. The end result will be a Python binarythat is optimized; suitable for distribution or production installation.
Enabled via configure's--with-lto
flag. LTO takes advantage of theability of recent compiler toolchains to optimize across the otherwisearbitrary.o
file boundary when building final executables or sharedlibraries for additional performance gains.
We have a comprehensive overview of the changes in theWhat's New in Python3.10 document. For a moredetailed change log, readMisc/NEWS, but a fullaccounting of changes can only be gleaned from thecommit history.
If you want to install multiple versions of Python, see the section belowentitled "Installing multiple versions".
Documentation for Python 3.10 is online,updated daily.
It can also be downloaded in many formats for faster access. The documentationis downloadable in HTML, PDF, and reStructuredText formats; the latter versionis primarily for documentation authors, translators, and people with specialformatting requirements.
For information about building Python's documentation, refer toDoc/README.rst.
Significant backward incompatible changes were made for the release of Python3.0, which may cause programs written for Python 2 to fail when run with Python3. For more information about porting your code from Python 2 to Python 3, seethePorting HOWTO.
To test the interpreter, typemake test
in the top-level directory. Thetest set produces some output. You can generally ignore the messages aboutskipped tests due to optional features which can't be imported. If a messageis printed about a failed test or a traceback or core dump is produced,something is wrong.
By default, tests are prevented from overusing resources like disk space andmemory. To enable these tests, runmake testall
.
If any tests fail, you can re-run the failing test(s) in verbose mode. Forexample, iftest_os
andtest_gdb
failed, you can run:
make test TESTOPTS="-v test_os test_gdb"
If the failure persists and appears to be a problem with Python rather thanyour environment, you canfile a bug report andinclude relevant output from that command to show the issue.
SeeRunning & Writing Testsfor more on running tests.
On Unix and Mac systems if you intend to install multiple versions of Pythonusing the same installation prefix (--prefix
argument to the configurescript) you must take care that your primary python executable is notoverwritten by the installation of a different version. All files anddirectories installed usingmake altinstall
contain the major and minorversion and can thus live side-by-side.make install
also creates${prefix}/bin/python3
which refers to${prefix}/bin/pythonX.Y
. If youintend to install multiple versions using the same prefix you must decide whichversion (if any) is your "primary" version. Install that version usingmakeinstall
. Install all other versions usingmake altinstall
.
For example, if you want to install Python 2.7, 3.6, and 3.10 with 3.10 being theprimary version, you would executemake install
in your 3.10 build directoryandmake altinstall
in the others.
Bug reports are welcome! You can use theissue tracker to report bugs, and/or submit pull requestsonGitHub.
You can also follow development discussion on thepython-dev mailing list.
If you have a proposal to change Python, you may want to send an email to thecomp.lang.python orpython-ideas mailing lists for initial feedback. APython Enhancement Proposal (PEP) may be submitted if your idea gains ground.All current PEPs, as well as guidelines for submitting a new PEP, are listed atpython.org/dev/peps/.
SeePEP 664 for Python 3.11 release details.
Copyright (c) 2001-2022 Python Software Foundation. All rights reserved.
Copyright (c) 2000 BeOpen.com. All rights reserved.
Copyright (c) 1995-2001 Corporation for National Research Initiatives. Allrights reserved.
Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
See theLICENSE forinformation on the history of this software, terms & conditions for usage, and aDISCLAIMER OF ALL WARRANTIES.
This Python distribution containsno GNU General Public License (GPL) code,so it may be used in proprietary projects. There are interfaces to some GNUcode but these are entirely optional.
All trademarks referenced herein are property of their respective holders.
About
The Python programming language
Resources
License
Security policy
Stars
Watchers
Forks
Packages0
Languages
- Python64.5%
- C33.4%
- C++0.7%
- M40.4%
- HTML0.4%
- Batchfile0.1%
- Other0.5%