2011-10-18 107 views
2

我一直在试图找到一个模块的位置,但我不能搜查蟒蛇文件夹,但仍无法找到它,但我知道它的存在Python模块的位置

>>> import math 
>>> math.__path__ 
Traceback (most recent call last): 
    File "<pyshell#13>", line 1, in <module> 
    math.__path__ 
AttributeError: 'module' object has no attribute '__path__' 
>>> math.__file__ 
Traceback (most recent call last): 
    File "<pyshell#14>", line 1, in <module> 
    math.__file__ 
AttributeError: 'module' object has no attribute '__file__' 
+2

欢迎来到StackOverflow!我通过突出显示代码并敲击代码['{}']按钮来修改格式。 – Johnsyweb

+0

谢谢你,你是怎么做到的?点击代码按钮只告诉我四倍空间来启动代码块:/也许我只是错过了一些东西,下一个问题我发布我会看看它。 – Arcticfoxx

+0

我认为数学是一个内建模块。 – bw1024

回答

5

如果它没有__file__属性,那么这意味着它可能内置到Python库本身(或其他可执行文件)中,并且不在磁盘上独立存在。

+0

好的,谢谢你,你知道一些python模块(默认安装),我可以看看模块的例子吗? – Arcticfoxx

+0

'site'通常是一个单独的文件。 –