ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]
ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]
ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]
目录
ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]
问题:
出现此错误是因为numpy版本不正确/不兼容。众所周知,大多数机器学习和深度学习库都在Numpy之上。像cv2、matplotlib、PyTorch、pyinstaller等Python模块也是其中之一。当我们从它们中安装任何模块时,它会自动安装require NUMPY版本。但是当我们在它之后安装另一个包时,另一个模块可能会根据兼容的依赖关系更改NUMPY的版本。现在下次导入上一个模块时,可能会出现此错误。
解决:
numpy的版本的问题,升到1.8.0以上OK了。
解决此错误的直接方法是将现有的numpy模块更新到numpy 1.8.0或更高。升级numpy的方法很多。
pip uninstall numpy
pip install numpy==1.8.0
完整错误:
(python36) C:\Users>python test.py
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "C:\Users\test.py ", line 15, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\onda\envs\python36\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 658, in _load_unlocked
File "", line 571, in module_from_spec
File "", line 922, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: numpy.core.multiarray failed to import
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 1, in
File "C:\Users\Reader.py", line 21, in
_kfbReader = swig_import_helper()
File "C:\Users\Reader.py", line 18, in swig_import_helper
return importlib.import_module('kfbReader')File "C:\Users\conda\envs\python36\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_Reader'
更多推荐
所有评论(0)