.Dd Aug 10, 2008 .Dt PYTHON 1 .Os .Sh NAME .Nm python , .Nm pythonw .Nd an interpreted, interactive, object-oriented programming language .Sh SYNOPSIS .Nm python .Ar ... .Nm pythonw .Ar ... .Sh DESCRIPTION To support multiple versions, the programs named .Nm python and .Nm pythonw now just select the real version of Python to run, depending on various settings. (As of Python 2.5, .Nm python and .Nm pythonw are interchangeable; both execute Python in the context of an application bundle, which means they have access to the Graphical User Interface; thus both can, when properly programmed, display windows, dialogs, etc.) The current supported versions are .Sy 2.5 (provided for backward-compatibility with the Python 2.5 family), .Sy 2.6 and .Sy 3.0 , with the default being .Sy 2.6 . Use .Pp .Dl % man python2.5 .Dl % man python2.6 .Dl % man python3.0 .Dl % man pythonw2.5 .Dl % man pythonw2.6 .Dl % man pythonw3.0 .Pp to see the man page for a specific version. Without a version specified, .Pp .Dl % man pydoc .Pp and the like, will show the man page for the (unmodified) default version of Python .Sy ( 2.6 ) . To see the man page for a specific version, use, for example, .Pp .Dl % man pydoc2.5 .Sh CHANGING THE DEFAULT PYTHON Using .Pp .Dl % defaults write com.apple.versioner.python Version 2.5 .Pp will make version .Sy 2.5 the user default when running the both the .Nm python and .Nm pythonw commands .Sy ( versioner is the internal name of the version-selection software used). .Pp To set a system-wide default, replace .Ql Li com.apple.versioner.python with .Ql Li /Library/Preferences/com.apple.versioner.python (admin privileges will be required). .Pp The environment variable .Ev VERSIONER_PYTHON_VERSION can also be used to set the .Nm python and .Nm pythonw version: .Pp .D1 Li % export VERSIONER_PYTHON_VERSION=2.5 Em # Bourne-like shells .D1 Li " " Sy or .D1 Li % setenv VERSIONER_PYTHON_VERSION 2.5 Em # C-like shells .Dl % python ... .Pp This environment variable takes precedence over the preference file settings. .Sh 64-BIT SUPPORT Versions .Sy 2.6 and .Sy 3.0 support 64-bit execution (which is on by default). Version .Sy 2.5 only supports 32-bit execution. .Pp Like the version of Python, the .Nm python command can select between 32 and 64-bit execution (when both are available). Use: .Pp .Dl % defaults write com.apple.versioner.python Prefer-32-Bit -bool yes .Pp to make 32-bit execution the user default (using .Ql Li /Library/Preferences/com.apple.versioner.python will set the system-wide default). The environment variable .Ev VERSIONER_PYTHON_PREFER_32_BIT can also be used (has precedence over the preference file): .Pp .D1 Li % export VERSIONER_PYTHON_PREFER_32_BIT=yes Em # Bourne-like shells .D1 Li " " Sy or .D1 Li % setenv VERSIONER_PYTHON_PREFER_32_BIT yes Em # C-like shells .Pp Again, the preference setting and environmental variable applies to both .Nm python and .Nm pythonw . .Sh USING A SPECIFIC VERSION Rather than using the .Nm python command, one can use a specific version directly. For example, running .Nm python2.5 from the command line will run the .Sy 2.5 version of Python, independent of what the default version of Python is. .Pp One can use a specific version of Python on the .Em #! line of a script, but that may have portability and future compatibility issues. .Pp Note that the preference files and environment variable that apply to the .Nm python command, do .Sy not apply when running a specific version of Python. In particular, running .Nm python2.6 will always default to 64-bit execution (unless one uses the .Xr arch 1 command to specifically select a 32-bit architecture). .Sh SEE ALSO .Xr python2.5 1 , .Xr python2.6 1 , .Xr python3.0 1 , .Xr pythonw2.5 1 , .Xr pythonw2.6 1 , .Xr pythonw3.0 1 , .Xr arch 1