我一直在尝试查找模块的位置,但我不能搜索 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__'
最佳答案
如果它没有 __file__
属性,则意味着它可能内置于 Python 库本身(或其他一些可执行文件)中,并且不独立存在于磁盘上。
关于Python 模块位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7803235/