我想知道数学库的位置,但是这段代码不起作用。我是 OOP 的菜鸟,所以你能用简单的语言解释一下我应该做什么。
import math
print(math.__file__)
引发 Traceback 错误(最后一次调用):文件“C:\Users\azizo\PycharmProjects\SF\z.py”,第 2 行,in print(math.file ) AttributeError: module 'math' has no attribute ' file '
我想知道数学库的位置,但是这段代码不起作用。我是 OOP 的菜鸟,所以你能用简单的语言解释一下我应该做什么。
import math
print(math.__file__)
引发 Traceback 错误(最后一次调用):文件“C:\Users\azizo\PycharmProjects\SF\z.py”,第 2 行,in print(math.file ) AttributeError: module 'math' has no attribute ' file '
这是答案 -如何找到 Python 模块的位置?
您也可以阅读,例如 - https://otus.ru/nest/post/951/
所有这些都在半分钟内被谷歌搜索...
该模块
math不是来自python您的 PC。该模块内置在解释器可执行文件中,因为它包装了. 如果您需要来源:https ://github.com/python/cpython/blob/main/Modules/cmathmodule.c
Cmath