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
  1. 安装opencv库: sudo pip install opencv-python
  2. 导入opencv库: import cv2
  3. 我这报错的原因是我的电脑在安装opencv前曾单独安装过numpy,而安装opencv的时候会自动再安装一个numpy,且二者安装在不同的路径下面,且默认使用的是我先前安装的numpy。
  4. 解决办法: 删除先前安装的numpy库,或把各个numpy版本删除完然后重装一遍opencv。
  5. 手动删除方法:
  6. import numpy
  7. print numpy.__path__ (找到numpy存在的路径,然后删除它)

转载于:https://www.cnblogs.com/v-BigdoG-v/p/7669801.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误是由于模块在编译时使用了与当前numpy版本不兼容的API版本导致的。具体而言,模块编译时使用的API版本为0xf,而当前安装的numpy版本为0xe,所以无法导入"numpy.core.multiarray"模块。 解决这个问题的一个可能方法是升级numpy到与模块编译时使用的API版本兼容的版本。你可以尝试更新numpy到最新版本,或者根据模块的要求安装特定版本的numpy。另外,还可以尝试重新编译模块以适应当前的numpy版本。具体的步骤和方法可以根据你使用的模块和环境进行调整。如果问题仍然存在,我建议你查看模块的文档或者与模块的开发者联系,以获取更具体的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [解决import tensorflow as tf 出错的原因](https://download.csdn.net/download/weixin_38571759/13737616)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [解决RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe](https://blog.csdn.net/weixin_51221144/article/details/128029715)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [解决OpenCV与Numpy版本不匹配问题](https://blog.csdn.net/weixin_45845039/article/details/130300561)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值