The code import torch reports an error ImportError: numpy.core.multiarray failed to import

Problem Description

After using Anaconda to install pytorch, import torch reports an error

 ImportError: numpy.core.multiarray failed to import

problem causes

The installed numpy does not match the torch version

solution

Uninstall the numpy in the original anaconda

pip uninstall numpy

reinstall numpy

pip install numpy

After reporting an error

torch 1.7.0 requires dataclasses, which is not installed.

Follow the prompts to install,

pip install dataclasses

success!

Guess you like

Origin blog.csdn.net/qq_39237205/article/details/129296058