0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

import numpyで"sanity check"と"No module"のエラーが出る

Last updated at Posted at 2020-11-11

#原因:
"sanity check"のエラーの問題はnumpyのversionが1.19.4であること。
"No module"のエラーの問題はnumpyの保存場所が違うこと。

#環境
Windows10
Python3.8.3
numpy1.19.4

#詳細
"RuntimeError: The current Numpy installation fails to pass a sanity check due to a bug in the windows runtime."のエラーはhttps://stackoverflow.com/questions/64654805/how-do-you-fix-runtimeerror-package-fails-to-pass-a-sanity-check-for-numpy-an
にあるように、バージョンを下げることで解決する。

コマンドで

pip install numpy==1.19.3

とすると、パッケージが
c:\users\owner\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages
に保存される。
このままではimportできずに、ModuleNotFoundError: No module named 'numpy'のエラーが出てしまうので、
numpyとnumpy-1.19.3.dist-infoのフォルダを
C:\Users\owner\AppData\Local\Programs\Python\Python38\Lib\site-packages
に移動させると正常に動作する。

確認用コード

test.py
import numpy
print(numpy.__version__)

出力結果
1.19.3

※pipが通らない場合は、https://qiita.com/Noi1205/items/a2379a61e9dd9d4b87a2
を参照

2020/11/11

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?