代码import torch 报错 ImportError: numpy.core.multiarray failed to import

问题描述

使用Anaconda安装pytorch后,import torch报错

 ImportError: numpy.core.multiarray failed to import

问题原因

安装的numpy 与 torch 版本不符

解决方案

卸载原来anaconda中的numpy

pip uninstall numpy

重新安装numpy

pip install numpy

之后报错

torch 1.7.0 requires dataclasses, which is not installed.

按照提示安装,

pip install dataclasses

成功!

猜你喜欢

转载自blog.csdn.net/qq_39237205/article/details/129296058