gpt4 book ai didi

python - 属性错误 : module 'numpy.core' has no attribute 'numerictypes'

转载 作者:行者123 更新时间:2023-12-05 09:31:10 29 4
gpt4 key购买 nike

使用 Python 3.9 和 numpy 1.21.2 的 PyCharm(2021.2.1 专业版)中的奇怪行为。当我使用“运行”运行我的程序时,它会按预期工作。但是当我用“调试”运行它时,会出现以下错误消息并且程序停止:

Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Python\JobAnalyzer\venv\lib\site-packages\numpy\__init__.py", line 200, in <module>
core.numerictypes.typeDict,
AttributeError: module 'numpy.core' has no attribute 'numerictypes'
python-BaseException

任何提示可能是什么原因?

它在以下行立即崩溃:

import matplotlib.pyplot as plt

在这一行的 numpy 中:

    # Numpy 1.20.0, 2020-10-19
__deprecated_attrs__["typeDict"] = (
core.numerictypes.typeDict, <--- CRASH HERE
"`np.typeDict` is a deprecated alias for `np.sctypeDict`."
)

最佳答案

错误已记录 here ,它与 PySide2 有关,PyCharm 默认使用它来实现 PyQt 兼容性。解决方法(除了降级 numpy)是转到 PyCharm 的设置/“构建、执行、部署”/“Python 调试器”,然后取消选中 PyQt 兼容性下拉列表的值或将其值更改为 AutoPySide2:

enter image description here

关于python - 属性错误 : module 'numpy.core' has no attribute 'numerictypes' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69043530/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com