python - 为什么 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'
解决方案
如果您有相同的模块名称“编号”,请检查您的项目目录,因为 python 标准库还包含一个具有该名称的模块。
所以改变你的模块名称,或者你可以试试这个:
1> Go to Run/Edit/Debug Configurations
2> For the current file, From the 'Configuration', 'Logs' Tab, Select Configuration Tab (Default)
3> Uncheck both 'Add content to PYTHONPATH' and 'Add source to PYTHONPATH'
推荐阅读
- kafka-consumer-api - 嵌入式 Kafka 未显示消费者偏移量
- r - 绘制在一个变量上计算的 geom_density() 与另一个变量
- c - scanf 使 C 中的第一个元素为空
- python - 在任何列中对具有匹配元素值的行进行聚类
- java - 使用 Mat 对象将 C++ 代码转换为 Java
- mongodb - 我们如何找到与给定查询匹配的随机文档并在 mongoDB 中自动更新它?
- r - 在 R 中使用 glmmTMB 预测人口级别的栅格堆栈
- .htaccess - .htaccess 被黑了?谷歌返回内部服务器错误
- java - JavaFX ScaleTransition
- sql - SQL - 按天限制结果