简体   繁体   English

发生异常:ImportError "No module named 'numpy.core._multiarray_umath'"

[英]Exception has occurred: ImportError "No module named 'numpy.core._multiarray_umath'"

WHAT I'M DOING:我在做什么:

I'm trying to import numpy:我正在尝试导入 numpy:

import numpy

but I'm getting the following error:但我收到以下错误:

Exception has occurred: 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.9 from "C:\Users\jack_l\AppData\Local\Programs\Python\Python39\python.exe"
  * The NumPy version is: "1.22.4"

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'

During handling of the above exception, another exception occurred:

I've gone through the help website and I couldn't find anything that helped (I tried everything, but IDK if I tried everything correctly :/).我浏览了帮助网站,但找不到任何有帮助的东西(我尝试了所有方法,但如果我正确尝试了所有方法,IDK :/)。

WHAT I'VE DONE AND WHAT I'VE FOUND:我做了什么,我发现了什么:

  • I currently have two versions of python installed on my device (3.9 and 3.10), and I think this may be causing the problem.我目前在我的设备上安装了两个版本的 python(3.9 和 3.10),我认为这可能是导致问题的原因。
  • I'm using VSCode, and my interpreter is on Python 3.9.13 (image 1), but when I do py --version in the PowerShell terminal, it says I'm on Python 3.10.4 (image 2)我正在使用 VSCode,我的解释器在 Python 3.9.13 上(图 1),但是当我在 PowerShell 终端中执行py --version时,它说我在 Python 3.10.4 上(图 2)
  • When I print os.environ.get('PYTHONPATH') , it gives me c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages , which I don't think is right but I don't know how to fix it.当我打印os.environ.get('PYTHONPATH')时,它给了我c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages ,我认为这是不对的,但我不知道如何解决。

Image 1:图 1:

在此处输入图像描述

Image 2:图 2:

在此处输入图像描述

FULL ERROR TRACEBACK:完整的错误回溯:

Traceback (most recent call last):
  File "c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages\numpy\core\__init__.py", line 23, in <module>
    from . import multiarray
  File "c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
    from . import overrides
  File "c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages\numpy\core\overrides.py", line 6, in <module>
    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 "c:\Users\jack_l\Documents\CAR_MIX\mega.py", line 8, in <module>
    import numpy as np
  File "c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages\numpy\__init__.py", line 144, in <module>
    from . import core
  File "c:\users\jack_l\appdata\local\programs\python\python310\lib\site-packages\numpy\core\__init__.py", line 49, in <module>
    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.9 from "C:\Users\jack_l\AppData\Local\Programs\Python\Python39\python.exe"
  * The NumPy version is: "1.22.4"

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'

If you recive this error probably the numpy library was installed in something like this: C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib .I think that you have used pip install numpy out of the virtual environment and when you have imported numpy, Python couldn't find it.To fix it try to install numpy in virtual environment and it will be stored at name_virtualenv/Lib/site-packeges .如果您收到此错误,则 numpy 库可能安装在以下位置: C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib 。我认为您已经在虚拟环境中使用了pip install numpy并且当您导入 numpy 时,Python 找不到它。要修复它,请尝试在虚拟环境中安装 numpy,它将存储在name_virtualenv/Lib/site-packeges中。

Create virtual environment:创建虚拟环境:

python -m virtualenv name The folders Include, Scripts and Lib will be created automatically python -m virtualenv name将自动创建文件夹 Include、Scripts 和 Lib

Activate启用

Before activate the virtual environment go to name\Scripts cd name\Scripts在激活虚拟环境之前转到 name\Scripts cd name\Scripts

Then: .\activate然后: .\activate

Install python-package安装 python 包

Install numpy with this command: pip install numpy .使用以下命令安装 numpy: pip install numpy Now numpy is stored at this path: Lib/site-packeges现在 numpy 存储在这个路径: Lib/site-packeges

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError:matplotlib 导入时没有名为“numpy.core._multiarray_umath”的模块 - ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' on matplotlib import kivy 中没有名为“numpy.core._multiarray_umath”的模块 - No module named 'numpy.core._multiarray_umath' in kivy TensorFlow - ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块 - TensorFlow - ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' 无法安装 numpy。 没有名为“numpy.core._multiarray_umath”的模块 - Unable to Install numpy. No module named 'numpy.core._multiarray_umath' ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块(安装 TensorFlow 时) - ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' (While installing TensorFlow) Windows VS 代码找不到 numpy 模块,即使它已安装(ModuleNotFoundError: No module named 'numpy.core._multiarray_umath') - Windows VS Code can't find numpy Module even though it is installed (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath') pd.read_hdf抛出“无法将此数组的WRITABLE标志设置为True”和“没有名为“ numpy.core._multiarray_umath”的模块” - pd.read_hdf throws 'cannot set WRITABLE flag to True of this array' and 'No module named 'numpy.core._multiarray_umath' 当我安装 tensorflow 时,我收到以下错误 ImportError: cannot import name '_set_madvise_hugepage' from 'numpy.core._multiarray_umath' - when I installed tensorflow I get the following error ImportError: cannot import name '_set_madvise_hugepage' from 'numpy.core._multiarray_umath' cPickle ImportError:没有名为multiarray的模块 - cPickle ImportError: No module named multiarray 当使用matplotlib时,我得到`没有名为_multiarray_umath的模块 - I get `No module named _multiarray_umath` when using matplotlib
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM