You don’t have to set either of them. PYTHONPATH
can be set to point to additional directories with private libraries in them. PYTHONHOME
sets the location of default libraries.
PYTHONHOME
Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.When
PYTHONHOME
is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, setPYTHONHOME
to prefix:exec_prefix.PYTHONPATH
Augment the default search path for module files. The format is the same as the shell’sPATH
: one or more directory pathnames separated byos.pathsep
(e.g. colons on Unix or semicolons on Windows). Non-existent directories are silently ignored.In addition to normal directories, individual PYTHONPATH entries may refer to zipfiles containing pure Python modules (in either source or compiled form). Extension modules cannot be imported from zipfiles.
The default search path is installation dependent, but generally begins with prefix/lib/pythonversion (see
PYTHONHOME
above). It is always appended toPYTHONPATH
.An additional directory will be inserted in the search path in front of
PYTHONPATH
as described above underInterface options
. The search path can be manipulated from within a Python program as the variablesys.path
.