1.Dd Aug 10, 2008 2.Dt PYTHON 1 3.Os 4.Sh NAME 5.Nm python , 6.Nm pythonw 7.Nd an interpreted, interactive, object-oriented programming language 8.Sh SYNOPSIS 9.Nm python 10.Ar ... 11.Nm pythonw 12.Ar ... 13.Sh DESCRIPTION 14To support multiple versions, the programs named 15.Nm python 16and 17.Nm pythonw 18now just select the real version of Python to run, depending on various 19settings. 20(As of Python 2.5, 21.Nm python 22and 23.Nm pythonw 24are interchangeable; both execute Python in the context of an application 25bundle, which means they have access to the Graphical User Interface; thus 26both can, when properly programmed, display windows, dialogs, etc.) 27The current supported versions are 28.Sy 2.6 29and 30.Sy 2.7 , 31with the default being 32.Sy 2.6 . 33Use 34.Pp 35.Dl % man python2.6 36.Dl % man python2.7 37.Dl % man pythonw2.6 38.Dl % man pythonw2.7 39.Pp 40to see the man page for a specific version. 41Without a version specified, 42.Pp 43.Dl % man pydoc 44.Pp 45and the like, will show the man page for the (unmodified) default 46version of Python 47.Sy ( 2.6 ) . 48To see the man page for a specific version, use, for example, 49.Pp 50.Dl % man pydoc2.7 51.Sh CHANGING THE DEFAULT PYTHON 52Using 53.Pp 54.Dl % defaults write com.apple.versioner.python Version 2.7 55.Pp 56will make version 57.Sy 2.7 58the user default when running the both the 59.Nm python 60and 61.Nm pythonw 62commands 63.Sy ( versioner 64is the internal name of the version-selection software used). 65.Pp 66To set a system-wide default, replace 67.Ql Li com.apple.versioner.python 68with 69.Ql Li /Library/Preferences/com.apple.versioner.python 70(admin privileges will be required). 71.Pp 72The environment variable 73.Ev VERSIONER_PYTHON_VERSION 74can also be used to set the 75.Nm python 76and 77.Nm pythonw 78version: 79.Pp 80.D1 Li % export VERSIONER_PYTHON_VERSION=2.7 Em # Bourne-like shells 81.D1 Li " " Sy or 82.D1 Li % setenv VERSIONER_PYTHON_VERSION 2.7 Em # C-like shells 83.Dl % python ... 84.Pp 85This environment variable takes precedence over the preference file settings. 86.Sh 64-BIT SUPPORT 87Versions 88.Sy 2.6 89and 90.Sy 2.7 91support 64-bit execution (which is on by default). 92.Pp 93Like the version of Python, the 94.Nm python 95command can select between 32 and 64-bit execution (when both are available). 96Use: 97.Pp 98.Dl % defaults write com.apple.versioner.python Prefer-32-Bit -bool yes 99.Pp 100to make 32-bit execution the user default (using 101.Ql Li /Library/Preferences/com.apple.versioner.python 102will set the system-wide default). 103The environment variable 104.Ev VERSIONER_PYTHON_PREFER_32_BIT 105can also be used (has precedence over the preference file): 106.Pp 107.D1 Li % export VERSIONER_PYTHON_PREFER_32_BIT=yes Em # Bourne-like shells 108.D1 Li " " Sy or 109.D1 Li % setenv VERSIONER_PYTHON_PREFER_32_BIT yes Em # C-like shells 110.Pp 111Again, the preference setting and environmental variable applies to both 112.Nm python 113and 114.Nm pythonw . 115.Sh USING A SPECIFIC VERSION 116Rather than using the 117.Nm python 118command, one can use a specific version directly. 119For example, running 120.Nm python2.7 121from the command line will run the 122.Sy 2.7 123version of Python, independent of what the default version of Python is. 124.Pp 125One can use a specific version of Python on the 126.Em #! 127line of a script, but that may have portability and future compatibility issues. 128.Pp 129Note that the preference files and environment variable that apply to the 130.Nm python 131command, do 132.Sy not 133apply when running a specific version of Python. 134In particular, running 135.Nm python2.6 136will always default to 64-bit execution 137(unless one uses the 138.Xr arch 1 139command to specifically select a 32-bit architecture). 140.Sh SEE ALSO 141.Xr python2.6 1 , 142.Xr python2.7 1 , 143.Xr pythonw2.6 1 , 144.Xr pythonw2.7 1 , 145.Xr arch 1 146