Reference

python(1)

an interpreted, interactive, object-oriented programming language

NAME

python, pythonw – an interpreted, interactive, object-oriented programming language

SYNOPSIS

python ...

pythonw ...

DESCRIPTION

To support multiple versions, the programs named python and pythonw select the real version of Python to run, depending on various settings. The current supported versions are 2.6 and 2.7, with the default being 2.7. Use

% man python2.6

% man python2.7

% man pythonw2.6

% man pythonw2.7

to see the man page for a specific version. Without a version specified these will show the man page for the (unmodified) default version of Python (2.7). To see the man page for a specific version of pydoc, for example, use

% man pydoc2.6

CHANGING THE DEFAULT PYTHON

Using

% defaults write com.apple.versioner.python Version 2.6

will make version 2.6 the user default when running both the python and pythonw commands (versioner is the internal name of the version-selection software used).

The environment variable VERSIONER_PYTHON_VERSION can also be used to set the python and pythonw version:

% export VERSIONER_PYTHON_VERSION=2.6 # Bourne-like shells

or

% setenv VERSIONER_PYTHON_VERSION 2.6 # C-like shells

% python ...

This environment variable takes precedence over the preference file settings.

USING A SPECIFIC VERSION

Rather than using the python command, one can use a specific version directly. For example, running python2.6 from the command line will run the 2.6 version of Python.

One can use a specific version of Python on the #! line of a script, but that may have portability and future compatibility issues.

Note that the preference files and environment variables that apply to the python command do not apply when running a specific version of Python. In particular, running python2.6 will always default to 64-bit execution (unless one uses the arch(1) command to specifically select a 32-bit architecture).

SEE ALSO

python2.6(1), python2.7(1), pythonw2.6(1), pythonw2.7(1), arch(1)

History