Let's look at Python's source code to see exactly what it's doing to generate that message. Since if all else fails, you can just look at the source.
If we search for Type "help", "copyright", "credits" or "license()" for more information.
, one of the results is in Modules/main.c
:
#define COPYRIGHT \
"Type \"help\", \"copyright\", \"credits\" or \"license\" " \
"for more information."
If we see where this is used, we can see that it's in the pymain_header
function - the relevant code is the following:
fprintf(stderr, "Python %s on %s\n", Py_GetVersion(), Py_GetPlatform());
if (config->site_import) {
fprintf(stderr, "%s\n", COPYRIGHT);
}
So, now we need to see what Py_GetVersion()
and Py_GetPlatform()
do.
Py_GetVersion does the following:
static char version[250];
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
return version;
So, now we need to see what Py_GetBuildInfo()
and Py_GetCompiler()
do. PY_VERSION
is the version of Python.
The relevant part of Py_GetBuildInfo()
is:
PyOS_snprintf(buildinfo, sizeof(buildinfo),
"%s%s%s, %.20s, %.9s", gitid, sep, revision,
DATE, TIME);
Inferring from the rest of the code, and the build configuration, gitid
is either the git tag of the current Python version, or if that doesn't exist, the git branch. sep
is just a separator, revision
is the short sha-1 hash of the HEAD
commit of the python source. I assume DATE
and TIME
are the date and time of the build.
The source of Py_GetCompiler
indicates that it outputs [Clang __clang_version__]
, [GCC __VERSION__]
, or [C++]
or [C]
, or something else (such as [MSC]
along with the MSC version) depending on what compiled Python.
Lastly, looking at the code for Py_GetPlatform()
, it's getting the platform of the current Python build. Possible values seem to include win32
, but I'm not sure what the others are, but I assume it refers to the specific Mac and Linux OS versions and such.
So, gathering all this info together, the breakdown is the following:
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32
- Python
- 3.8.7: Python Version
- (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51): (git branch or tag name:git revision short sha-1, build date, build time)
- [MSC v.1928 64 bit (AMD64)]: [Compiler name and version]
- on
- win32: platform name