2301_76851647 2025-03-18 22:15 采纳率: 33.3%
浏览 81

pycharm的numpy库问题

Traceback (most recent call last):
File "D:\dev\Lib\site-packages\numpy_core_init_.py", line 23, in
from . import multiarray
File "D:\dev\Lib\site-packages\numpy_core\multiarray.py", line 10, in
from . import overrides
File "D:\dev\Lib\site-packages\numpy_core\overrides.py", line 8, in
from numpy._core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy._core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\dev\Lib\site-packages\numpy_init.py", line 127, in
from numpy.config import show as show_config
File "D:\dev\Lib\site-packages\numpy_config
.py", line 4, in
from numpy._core.multiarray_umath import (
File "D:\dev\Lib\site-packages\numpy_core_init
.py", line 49, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html 

Please note and check the following:

  • The Python version is: Python3.12 from "D:\dev\python.exe"
  • The NumPy version is: "2.1.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy._core._multiarray_umath'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "E:\project\pythonProject3\二级质谱数据的处理\3.py", line 2, in
import numpy
File "D:\dev\Lib\site-packages\numpy_init_.py", line 132, in
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.

为什么有这个问题

  • 写回答

4条回答 默认 最新

  • 道友老李 JWE233286一种基于机器视觉的水表指针读数识别及修正的方法 专利发明者 2025-03-18 22:16
    关注
    让【道友老李】来帮你解答,本回答参考gpt编写,并整理提供,如果还有疑问可以点击头像关注私信或评论。
    如果答案让您满意,请采纳、关注,非常感谢!
    这个问题出现的原因是由于在导入numpy库时出现了错误。其中,主要的错误是由于缺少名为`numpy._core._multiarray_umath`的模块。 可能的原因包括:
    1. Python或NumPy版本不匹配,比如可能的Python版本为3.12,但是NumPy版本为2.1.3。
    2. 安装的NumPy库可能出现了问题。
    3. 在导入numpy时尝试从源目录中导入,而不是从安装目录中导入。 解决方法包括:
    4. 确保Python和NumPy的版本匹配并且正确安装。
    5. 可以尝试重新安装NumPy库或者更新NumPy库。
    6. 确保在导入numpy时,不要从源代码目录中导入,可以在其他地方启动Python解释器。 以下是可能的Python代码,用于重新安装或更新NumPy库:
    pip install --upgrade numpy
    

    另外,在错误提示中提供了链接到NumPy文档的详细故障排除页面,你可以继续查阅文档以获取进一步帮助。

    评论

报告相同问题?

问题事件

  • 创建了问题 3月18日