致命错误:安装opencv时找不到"Python.h"文件 [英] fatal error: 'Python.h' file not found while installing opencv

查看:417
本文介绍了致命错误:安装opencv时找不到"Python.h"文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mac OS X 10.10.5上为Python安装opencv 3.1 我正在按照此处概述的步骤进行操作-http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

I am trying to get opencv 3.1 installed for Python on my Mac OS X 10.10.5 I'm following the steps as outlined here - http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

在完成所有设置后实际上尝试安装opencv时,出现以下错误:

When I actually try installing opencv after all the setup, I get the following error:

.../opencv/modules/python/src2/cv2.cpp:6:10: fatal error: 
  'Python.h' file not found
 #include <Python.h>
          ^

我环顾了StackOverflow,发现大多数面临此问题的人都在使用Anaconda,而我的情况并非如此.如果有人可以指出正确的方向来解决此问题,那就太好了.

I looked around StackOverflow and found that most people facing this issue are using Anaconda, which is not my case. It would be great if someone could point me in the right direction to get this fixed.

谢谢

推荐答案

如果在创建* .cpp文件之一时未找到Python.h,请设置以下ENV变量

If Python.h is not found while making one of the *.cpp files, set the following ENV variable

export CPLUS_INCLUDE_PATH=/System/Library/Frameworks/Python.framework/Headers

请检查系统中路径的存在,并确保存在Python.h.

Please check the existence of the path in your system and make sure that Python.h is there.

这篇关于致命错误:安装opencv时找不到"Python.h"文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆