Path to Python

Source: Internet
Author: User

"path to Python "

1.PYTHONHOME

The location of the libraries Python. By default, the libraries is searched in prefix/lib/pythonversion exec_prefix/lib/pythonversion and, where and is prefix exec_prefix installation-dependent directories, b Oth defaulting to /usr/local .

Pythonhome is the path to the Python library.

When PYTHONHOME was set to a single directory, its value replaces both prefix and exec_prefix . To specify different values for these, set to PYTHONHOME prefix:exec_prefix .

When prefix, Exec_rpefix are inconsistent, pythonhome is set to Prefix:exec_prefix.

2.PYTHONPATH

Augment the default search path for module files. The format is the same as the Shell's PATH : one or more directory pathnames separated by os.pathsep (e.g. colons on Unix o R semicolons on Windows). Non-existent directories is silently ignored.

The default search path for module.

In addition to normal directories, individual PYTHONPATH entries could refer to zipfiles containing pure Python modules (in E Ither source or compiled form). Extension modules cannot is imported from Zipfiles.

It is possible to add a zip file.

The default search path is installation dependent and generally begins with prefix/lib/pythonversion (see PYTHONHOME above). It's always appended to PYTHONPATH .

/lib/pythonversion was added on the basis of pythomhome.

3. Site

  This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter ' s -S option.

Importing this module would append site-specific paths to the module search path and add a few builtins, unless is -S u Sed.

Site module will be loaded automatically, site will add site-specific path into module search path. Even if-S is specified.

It starts by constructing up to four directories from a head and a tail part. For the head part, it uses sys.prefix and Sys.exec_prefix ; Empty heads is skipped. For the tail part, it uses the empty string and then lib/site-packages OWS) or lib/python x.y Span class= "Pre" >/site-packages (on Unix and Macintosh). For each of the distinct head-tail combinations, it sees if it refers to a existing directory, and if so, adds it to sys.path and also inspects the newly added path for configuration files.

A path configuration file is a file whose name have the form and exists in one of the four name.pth directories mentioned Abov E Its contents is additional items (one per line) to being added to sys.path . Non-existing items is never added to sys.path . No item is added to more sys.path than once. Blank lines and lines beginning with is # skipped. Lines starting with import (followed by space or tab) is executed.

The. PTH is a path file.

4, after these path manipulations, an attempt are made to import a module named sitecustomize , which can perform arbitrary site-spec Ific customizations. It is typically created by a system administrator in the Site-packages directory.

5, after this, an attempt are made to import a module named usercustomize , which can perform arbitrary user-specific customizations, If is ENABLE_USER_SITE true. This file was intended to being created in the user site-packages directory (see below), which was part of sys.path unless disable D by -s .

Cond...

Path to Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.