十月小mumu 2023-04-03 21:03 采纳率: 75%
浏览 40
已结题

vscode中提示NumPy版本1.22.3,但下载的是1.22.4

在cmd中查询numpy版本为1.22.4

img

但在vscode里运行时提示


发生异常: 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.9 from "D:\anaconda\envs\tensorflow\python.exe"
  * The NumPy version is: "1.22.3"

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: 找不到指定的模块。
ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

During handling of the above exception, another exception occurred:

  File "E:\桌面1\yolo3-pytorch-master\utils\callbacks.py", line 4, in <module>
    import torch
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.9 from "D:\anaconda\envs\tensorflow\python.exe"
  * The NumPy version is: "1.22.3"

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: 找不到指定的模块。

请问应该怎么解决?

  • 写回答

2条回答 默认 最新

  • callinglove 2023-04-04 09:43
    关注

    通过截图分析如下:

    • pip安装将numpy安装在了anaconda主目录下了,正如pip show numpy看到Location路径
    • 你在使用VSCode时候使用的应该是anaconda一个虚拟环境,而虚拟环境中安装的应该numpy 1.22.3

    参考博文Anaconda-用conda创建python虚拟环境

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月12日
  • 已采纳回答 4月4日
  • 创建了问题 4月3日