👏

【解決】VSCode+Miniconda環境でnumpyのImportError

2022/12/10に公開

問題

例外が発生しました: 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 "C:\miniconda3\envs\ICSS\python.exe"
  • The NumPy version is: "1.21.6"

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: 指定されたモジュールが見つかりません。

During handling of the above exception, another exception occurred:

File "C:\python-test\gazou.py", line 18, in <module>
import numpy as np

解決方法(弱)

Anaconda Promptから起動すればOK

python gazou.py

解決方法(強)

こちらの方がスマートな解決手段だと思います。

https://jp.magicode.io/shin1007/articles/42d2391acd014a7db811543e4408af6a

Discussion