为什么Pycharm调试程序时显示
AttributeError: module 'numbers' has no attribute 'Number'
,但运行却没有错误?
Traceback (most recent call last):
File "E:\Program Files\JetBrains\PyCharm 2019.1\helpers\pydev\pydevd.py", line 15, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY34_OR_GREATER, IS_PY36_OR_GREATER, IS_PYCHARM, get_thread_id, \
File "E:\Program Files\JetBrains\PyCharm 2019.1\helpers\pydev\_pydevd_bundle\pydevd_constants.py", line 169, in <module>
from _pydev_imps._pydev_saved_modules import thread
File "E:\Program Files\JetBrains\PyCharm 2019.1\helpers\pydev\_pydev_imps\_pydev_saved_modules.py", line 21, in <module>
import xmlrpc.client as xmlrpclib
File "C:\Users\A\AppData\Local\Programs\Python\Python37\lib\xmlrpc\client.py", line 135, in <module>
from decimal import Decimal
File "C:\Users\A\AppData\Local\Programs\Python\Python37\lib\decimal.py", line 3, in <module>
from _decimal import *
AttributeError: module 'numbers' has no attribute 'Number'
检查您的项目目录是否有相同的模块名称
number
,因为Python标准库也包含具有该名称的模块。
所以更改你的模块名称或者你可以尝试这个: