Importing the numpy C-extensions failed.

简介: Importing the numpy C-extensions failed.

使用cuda加速时候出现了一堆出错,然后调试的时候发现导入torch都报错了,错误信息如下:

  • errorinfo:


Traceback (most recent call last) File

“E:\anacanda\envs\pytorch\lib\site-packages\numpy\core_init_.py”,

line 22, in

from . import multiarray File “E:\anacanda\envs\pytorch\lib\site-packages\numpy\core\multiarray.py”,

line 12, in

from . import overrides File “E:\anacanda\envs\pytorch\lib\site-packages\numpy\core\overrides.py”,

line 7, in

from numpy.core._multiarray_umath import ( ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File

“E:/PyCharm/workspace/My_cGAN/cgan.py”, line 1, in

import torch File “E:\anacanda\envs\pytorch\lib\site-packages\torch_init_.py”, line

190, in

from torch.C import * File "E:\anacanda\envs\pytorch\lib\site-packages\numpy_init.py", line

140, in

from . import core File “E:\anacanda\envs\pytorch\lib\site-packages\numpy\core_init_.py”,

line 48, 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.7 from

“E:\anacanda\envs\pytorch\python.exe” * The NumPy version is:

“1.19.5”

and make sure that they are the versions you expect. Please carefully

study the documentation linked above for further help.

Original error was: DLL load failed: 找不到指定的模块。

Process finished with exit code 1


  • 翻译


回溯(最近一次调用最后一次):

文件“E:\anacanda\envs\pytorch\lib\site-packages\numpy\core_init_.py”,第

22 行,在 中

从 。导入多阵列 文件“E:\anacanda\envs\pytorch\lib\site-packages\numpy\core\multiarray.py”,第

12 行,

从 。导入覆盖 文件“E:\anacanda\envs\pytorch\lib\site-packages\numpy\core\overrides.py”,第

7 行,在 中

从 numpy.core._multiarray_umath 导入( ImportError: DLL load failed: 找不到指定的模块。

在处理上述异常的过程中,又发生了一个异常:

回溯(最近一次调用最后一次):

中的文件“E:/PyCharm/workspace/My_cGAN/cgan.py”,第 1 行

进口火炬 文件“E:\anacanda\envs\pytorch\lib\site-packages\torch_init_.py”,第 190

行,在 中

从 torch.C 导入 * 文件“E:\anacanda\envs\pytorch\lib\site-packages\numpy_init.py”,第 140

行,在 中

从 。进口核心 文件“E:\anacanda\envs\pytorch\lib\site-packages\numpy\core_init_.py”,第

48 行,在 中

引发导入错误(味精) 导入错误:

重要提示:请阅读本文以获取有关如何解决此问题的建议!

导入 numpy C 扩展失败。此错误可能发生在 很多原因,通常是由于您的设置问题或 NumPy 的方式 安装。

我们在以下位置汇总了一些常见原因和故障排除提示:

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


请注意并检查以下内容:

Python 版本为:Python3.7 from “E:\anacanda\envs\pytorch\python.exe”

NumPy 版本为:“1.19.5”

并确保它们是您期望的版本。 请仔细研究上面链接的文档以获得进一步的帮助。

原始错误为:DLL load failed: 找不到指定的模块。

进程以退出代码 1 结束


提取信息为:

Importing the numpy c-extensions failed 导入 numpy C 扩展失败。

所以重新安装了一次numpy,解决方案:

pip uninstall -y numpy
pip uninstall -y setuptools
pip install setuptools
pip install numpy

image.png


可以重新导入torch了。

参考:https://blog.csdn.net/kaede0v0/article/details/115557457

目录
打赏
0
0
0
0
21
分享
相关文章
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
Python错误笔记(一):CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up env
这篇文章讨论了CUDA初始化时出现的未知错误及其解决方案,包括重启系统和安装nvidia-modprobe。
799 0
ERROR: Could not find a version that satisfies the requirement thop (from versions: none) ERROR: No
这篇文章介绍了在尝试安装`thop`包时遇到的"No matching distribution found"错误,并提供了通过直接从GitHub源码安装`thop`的解决方法。
ERROR: Could not find a version that satisfies the requirement thop (from versions: none) ERROR: No
【Python】已解决:FutureWarning: The frame.append method is deprecated and will be removed from pandas in
【Python】已解决:FutureWarning: The frame.append method is deprecated and will be removed from pandas in
695 0
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
【5月更文挑战第12天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
2881 0
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
【6月更文挑战第7天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
1482 0
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
1431 0
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
Python安装库Could not find a version that satisfies the requirement requests (from versions: none)
Python安装库Could not find a version that satisfies the requirement requests (from versions: none)
160 1
Error: Plugin/Preset files are not allowed to export objects, only functions……
Error: Plugin/Preset files are not allowed to export objects, only functions……
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等