RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 / ImportError
Posted 笑面浮屠
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 / ImportError相关的知识,希望对你有一定的参考价值。
-
问题描述:安装python的opencv库后,导入时出现RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9, ImportError: numpy.core.multiarray failed to import.
-
系统: OSX Yosemite/Python 2.7
- 安装opencv库: sudo pip install opencv-python
- 导入opencv库: import cv2
- 我这报错的原因是我的电脑在安装opencv前曾单独安装过numpy,而安装opencv的时候会自动再安装一个numpy,且二者安装在不同的路径下面,且默认使用的是我先前安装的numpy。
- 解决办法: 删除先前安装的numpy库,或把各个numpy版本删除完然后重装一遍opencv。
- 手动删除方法:
- import numpy
- print numpy.__path__ (找到numpy存在的路径,然后删除它)
以上是关于RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 / ImportError的主要内容,如果未能解决你的问题,请参考以下文章
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 / ImportError
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
__init__.py",第 92 行,在 <module> 中引发 RuntimeError("Python 3.5 或更高版本是必需的")
解决 RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd