Bootstrap

python导入Numpy失败,ImportError: Unable to import required dependencies: numpy:

ImportError: Unable to import required dependencies:
numpy:
 
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 "D:\tools\Anaconda\envs\pytorch\python.exe"
* The NumPy version is: "1.21.2"
 
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 while importing _multiarray_umath: 找不到指定的模块。

看这个报错信息,是python版本与Numpy版本不匹配,
我这Python3.7版本 应该匹配Numpy1.16.4版本
因此卸载NumPy1.21.2,重新安装。

1、打开Anaconda Prompt的命令行窗口
2、输入 pip uninstall numpy。 卸载 numpy 1.21.2
3、pip install numpy==1.16.4。 安装numpy 1.16.4
成功后关闭Anaconda Prompt的命令行窗口再重新打开即可

问题已解决
在这里插入图片描述

;