在python中导入数学[关闭]

问题描述 投票:-5回答:2

我刚刚开始学习python,现在我正试图了解Math库。我做了一个非常简单的测试(只有3行代码):

Import Math
number = math.ceil(2.8)
print(number)

通过运行此代码,我得到了错误:

AttributeError: partially initialized module 'math' has no attribute 'ceil' (most likely due to a circular import)

有人可以帮助我理解这种错误吗?

python python-3.x math pycharm
2个回答
0
投票

import math不应大写。


0
投票

因为Python区分大小写

您执行此Import Math

尝试一下

import math

number = math.ceil(2.8)
print(number)
© www.soinside.com 2019 - 2024. All rights reserved.