我找不到谁定义了'__path__'
,为什么可以使用'__path__'
。
import os
import sys
import warnings
import ConfigParser # ConfigParser is not a virtualenv module, so we can use it to find the stdlib
dirname = os.path.dirname
distutils_path = os.path.join(os.path.dirname(ConfigParser.__file__), 'distutils')
if os.path.normpath(distutils_path) == os.path.dirname(os.path.normpath(__file__)):
warnings.warn(
"The virtualenv distutils package at %s appears to be in the same location as the system distutils?")
else:
__path__.insert(0, distutils_path)#who defined me.???
exec open(os.path.join(distutils_path, '__init__.py')).read()
我找到了uuu path_uuu变量的以下描述:
这里:http://www.python.org/doc/essays/packages.html
该页讨论了Python1.5中的“内置包支持”,但它可能仍然适用。
我不能告诉你更多,因为我不使用Python。我在谷歌上找到了这个链接。
编辑:是的!我本来想提醒你我们讨论过的yesterday但是一个好的开始是阅读steveha的中文Python文档。
您确实需要阅读一些Python文档并学习该语言的基础知识。
我查过了,你好像会说中文。以下是Python中文文档资源:
http://www6.uniovi.es/python/doc/NonEnglish.html#chinese
现在,回答你的问题。我不知道答案是什么,所以我用了谷歌。我在谷歌上搜索了“
Python __path__
”,很快发现:http://docs.python.org/tutorial/modules.html
相关问题 更多 >
编程相关推荐