导入错误:导入 _multiarray_umath 时 DLL 加载失败:

问题描述 投票:0回答:1

当我尝试运行“import seaborn”或“from sklearn.model_selection import train_test_split”等命令时,我收到此错误。我尝试卸载并安装 python、numpy、pandas、scipy 等或更改它们的版本。

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
ImportError: DLL load failed while importing _multiarray_umath: Belirtilen modül bulunamadı.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14644/1042904620.py in <module>
----> 1 import seaborn

~\anaconda3\lib\site-packages\seaborn\__init__.py in <module>
      1 # Import seaborn objects
----> 2 from .rcmod import *  # noqa: F401,F403
      3 from .utils import *  # noqa: F401,F403
      4 from .palettes import *  # noqa: F401,F403
      5 from .relational import *  # noqa: F401,F403

~\anaconda3\lib\site-packages\seaborn\rcmod.py in <module>
      5 import matplotlib as mpl
      6 from cycler import cycler
----> 7 from . import palettes
      8 
      9 

~\anaconda3\lib\site-packages\seaborn\palettes.py in <module>
      7 from .external import husl
      8 
----> 9 from .utils import desaturate, get_color_cycle
     10 from .colors import xkcd_rgb, crayons
     11 

~\anaconda3\lib\site-packages\seaborn\utils.py in <module>
      8 
      9 import numpy as np
---> 10 from scipy import stats
     11 import pandas as pd
     12 import matplotlib as mpl

~\anaconda3\lib\site-packages\scipy\__init__.py in __getattr__(name)
    160 def __getattr__(name):
    161     if name in submodules:
--> 162         return _importlib.import_module(f'scipy.{name}')
    163     else:
    164         try:

~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~\anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>
    604 from ._warnings_errors import (ConstantInputWarning, NearConstantInputWarning,
    605                                DegenerateDataWarning, FitError)
--> 606 from ._stats_py import *
    607 from ._variation import variation
    608 from .distributions import *

~\anaconda3\lib\site-packages\scipy\stats\_stats_py.py in <module>
     35 from numpy import array, asarray, ma
     36 
---> 37 from scipy import sparse
     38 from scipy.spatial.distance import cdist
     39 from scipy.spatial import distance_matrix

~\anaconda3\lib\site-packages\scipy\__init__.py in __getattr__(name)
    160 def __getattr__(name):
    161     if name in submodules:
--> 162         return _importlib.import_module(f'scipy.{name}')
    163     else:
    164         try:

~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~\anaconda3\lib\site-packages\scipy\sparse\__init__.py in <module>
    293 
    294 from ._base import *
--> 295 from ._csr import *
    296 from ._csc import *
    297 from ._lil import *

~\anaconda3\lib\site-packages\scipy\sparse\_csr.py in <module>
      9 from ._matrix import spmatrix
     10 from ._base import _spbase, sparray
---> 11 from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
     12                            get_csr_submatrix)
     13 from ._sputils import upcast

ImportError: numpy._core.multiarray failed to import

一切都很完美,直到我尝试将 spacy 模块安装到 python 中。我不知道这是否相关,但请帮助我!

python scipy seaborn importerror
1个回答
0
投票

我遇到了同样的问题,但场景不同。我相信这与 numpy 有关。 我尝试将我的 numpy 降级为 < 2.0. That resolved in my case, as in my case, I was trying to load a model created using numpy 1.xx using numpy 2.xx.

根据您的情况,检查 spacy 和 numpy 之间的兼容性。请检查以下问题:

https://github.com/explosion/spaCy/issues/13528

我的建议尝试将 numpy 从 2.xx 降级到 1.xx

© www.soinside.com 2019 - 2024. All rights reserved.