码迷,mamicode.com
首页 > 其他好文 > 详细

Site-specific configuration

时间:2015-06-02 19:38:52      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

Site-specific configuration

  site.py会被自动导入。通过-S选项可阻止此行为。

  Importing this module will append site-specific paths to the module search path and add a few builtins.

1、四个目录。

  It starts by constructing up to 4 directories from a head and a tail part. For the head part, it uses sys.prefix and sys.exec_prefix; empty heads are skipped. For the tail part, it uses the empty string and then lib/site-packages (on Windows) or lib/pythonX.Y/site-packages and then lib/site-python (on Unix and Macintosh). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, and if so, adds it to sys.path and also inspects the newly added path for configuration files.

2、.pth文件。

  A path configuration file is a file whose name has the form name.pth and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to sys.path. Non-existing items are never added to sys.path, and no check is made that the item refers to a directory rather than a file. No item is added to sys.path more than once. Blank lines and lines beginning with # are skipped. Lines starting with import (followed by space or tab) are executed.

 

Site-specific configuration

标签:

原文地址:http://www.cnblogs.com/tekka/p/4546923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!