import torch中DLL load failed while importing _multiarray_umath: 找不到指定的模块,一步解决。

网上找了好多方法,大部分是换conda 环境,版本,激活,光激活试了好久,最终还是没有激活。(2)更换numpy的版本,python版本,方法都不行 。





另外建议先试一下conda uninstall / pip uninstall numpy



 Troubleshooting ImportError — NumPy v1.23.dev0 Manual

Eclipse and PyDev — Anaconda documentation

Using Python Environments in Visual Studio Code

Configure a Conda virtual environment | PyCharm

Managing environments — conda dev documentation


解决numpy:DLL load failed while importing _multiarray_umath: 找不到指定的模块。 – 猫猫子 – 博客园

2、第二个问题,jupyter中输入import torch,报错NameError: name ‘_C‘ is not defined,


NameError                                 Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 import torch

File D:\Users\lilin\miniconda3\lib\site-packages\torch\, in <module>
    216         raise ImportError(textwrap.dedent('''
    217             Failed to load PyTorch C extensions:
    218                 It appears that PyTorch has loaded the `torch/_C` folder
    226                 or by running Python from a different directory.
    227             ''').strip()) from None
    228     raise  # If __file__ is not None the cause is unknown, so just re-raise.
--> 231 __all__ += [name for name in dir(_C)
    232             if name[0] != '_' and
    233             not name.endswith('Base')]
    235 if not TYPE_CHECKING:
    236     # issue 38137 and python issue 43367. Submodules of a C extension are
    237     # non-standard, and attributes of those submodules cannot be pickled since
    238     # pickle expect to be able to import them as "from _C.sub import attr"
    239     # which fails with "_C is not a package
    240     for attr in dir(_C):

NameError: name '_C' is not defined


pip install Cython



物联沃-IOTWORD物联网 » import torch中DLL load failed while importing _multiarray_umath: 找不到指定的模块,一步解决。