首页 > 其他 > 详细

Site-specific configuration

时间:2015-06-02 19:38:16      阅读:217      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!