0% found this document useful (0 votes)
1K views1 page

Python in A Nutshell 4th Edition by Alex Martelli - Bibis - Ir 6

On Windows, the Python launcher py.exe is installed in the system directory so it is always on the PATH, allowing Python to be launched from any command prompt by typing py. Several environment variables affect how Python runs, including PYTHONHOME which specifies the Python installation directory and PYTHONPATH which extends Python's module search path to additional directories.

Uploaded by

gjhgjgj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views1 page

Python in A Nutshell 4th Edition by Alex Martelli - Bibis - Ir 6

On Windows, the Python launcher py.exe is installed in the system directory so it is always on the PATH, allowing Python to be launched from any command prompt by typing py. Several environment variables affect how Python runs, including PYTHONHOME which specifies the Python installation directory and PYTHONPATH which extends Python's module search path to additional directories.

Uploaded by

gjhgjgj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Environment Variables: Describes environment variables and their effects on Python's behavior and module execution.
  • PEP 397 and Python Launching: Explains Python 3.x launcher on Windows and how it operates differently from older methods.

PEP 397

On Windows, since PEP 397, [Link], the launcher, installs in the system area, meaning it is sure—
barring further manipulation on your part—to be on the PATH.

On Windows, press the Windows key and start typing python: “Python
3.x (command-line)” appears, along with other choices, such as “IDLE
(Python GUI).” If you have the [Link] launcher installed (which is the
normal case), at any command prompt, typing py launches Python.

Environment Variables
Besides PATH, other environment variables affect the python program.
Some environment variables have the same effects as options passed to
python on the command line, as we show in the next section. Several
environment variables provide settings not available via command-line
options. The following list covers just the basics of a few frequently used
ones; for all details, see the online docs.
PYTHONHOME
The Python installation directory. A lib subdirectory, containing the
standard Python library, must exist under this directory. On Unix-like
systems, the standard library modules should be in lib/python-3.x for
Python 3.x, where x is the minor Python version. If not set, Python uses
some heuristics to locate the installation directory.

PYTHONPATH
A list of directories, separated by colons on Unix-like systems, and by
semicolons on Windows. Python can import modules from these
directories. This list extends the initial value for Python’s [Link]
variable. We cover modules, importing, and [Link] in Chapter
“Modules.”

PEP 397
On Windows, since PEP 397, (https://www.python.org/dev/peps/pep-0397) py.exe, the launcher, installs in the system ar

You might also like