Mac Developer Library Developer


This manual page is for Mac OS X version 10.9

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • To learn how the manual is organized or to learn about command syntax, read the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Developer Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.

PYTHON(1)                 BSD General Commands Manual                PYTHON(1)

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

     python ...
     pythonw ...

     To support multiple versions, the programs named python and pythonw now just select the real version of
     Python to run, depending on various settings.  (As of Python 2.5, python and pythonw are interchange-able; interchangeable;
     able; 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 2.6 and 2.7, with the default being 2.6.  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,

           % man pydoc

     and the like, will show the man page for the (unmodified) default version of Python (2.6).  To see the
     man page for a specific version, use, for example,

           % man pydoc2.7


           % defaults write Version 2.7

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

     To set a system-wide default, replace `' with
     `/Library/Preferences/' (admin privileges will be required).

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

           % export VERSIONER_PYTHON_VERSION=2.7 # Bourne-like shells
           % setenv VERSIONER_PYTHON_VERSION 2.7 # C-like shells
           % python ...

     This environment variable takes precedence over the preference file settings.

     Versions 2.6 and 2.7 support 64-bit execution (which is on by default).

     Like the version of Python, the python command can select between 32 and 64-bit execution (when both
     are available).  Use:

           % defaults write Prefer-32-Bit -bool yes

     to make 32-bit execution the user default (using `/Library/Preferences/' will
     set the system-wide default).  The environment variable VERSIONER_PYTHON_PREFER_32_BIT can also be used
     (has precedence over the preference file):

           % export VERSIONER_PYTHON_PREFER_32_BIT=yes # Bourne-like shells
           % setenv VERSIONER_PYTHON_PREFER_32_BIT yes # C-like shells

     Again, the preference setting and environmental variable applies to both python and pythonw.

     Rather than using the python command, one can use a specific version directly.  For example, running
     python2.7 from the command line will run the 2.7 version of Python, independent of what the default
     version of Python is.

     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 variable 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).

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

BSD                              Aug 10, 2008                              BSD

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.