Programs and other executable files
can live in many directories, so operating systems provide a search path that
lists the directories that the OS searches for executables.
The path is stored in an environment
variable, which is a named string maintained by the operating system. These
variables contain information available to the command shell and other programs.
The path variable is named
PATH in Unix or Path in Windows (Unix is case-sensitive; Windows is not).
In Mac OS, the installer handles the
path details. To invoke the Python interpreter from any particular directory,
you must add the Python directory to your path.
Setting
path at Unix/Linux:
To add the Python directory to the
path for a particular session in Unix:
- In the csh shell:
type
setenv PATH "$PATH:/usr/local/bin/python" and press Enter. - In the bash shell (Linux): type
export PATH="$PATH:/usr/local/bin/python" and press Enter. - In the sh or ksh shell: type
PATH="$PATH:/usr/local/bin/python" and press Enter.
Note: /usr/local/bin/python is the path of the Python directory
Setting
path at Windows:
To add the Python directory to the
path for a particular session in Windows:
- At the command prompt : type
path %path%;C:\Python and press Enter.
Note: C:\Python is the path of the Python directory