make pycaffe致命错误:找不到“Python.h”文件 [英] make pycaffe fatal error: 'Python.h' file not found

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

问题描述

我编译caffe在mac运行OSX 10.9.5和我知道试图编译pycaffe。当我运行make pycaffe在caffe根文件夹,我得到:

I compiled caffe on a mac running OSX 10.9.5 and I know trying to compile pycaffe. When I run make pycaffe in the caffe root folder, I get:

CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:1:10: fatal error: 'Python.h' file not found
#include <Python.h>  // NOLINT(build/include_alpha)
         ^
1 error generated.
make: *** [python/caffe/_caffe.so] Error 1

我可以解决这个问题吗?

how can I fix this?

Makefile.config可能有问题。我如何知道我的PYTHONPATH是什么?

Perhaps is something wrong with Makefile.config. How do I know what is my PYTHONPATH?

推荐答案

看看评论,我看到你使用Anaconda。在 Makefile.config ,您应该取消注释Anaconda专用的行:

Looking at the comments, I see that you use Anaconda. In Makefile.config, you should uncomment the lines dedicated to Anaconda:

# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
        # $(ANACONDA_HOME)/include/python2.7 \
        # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib


$ b b

Python.h 位于 $(ANACONDA_HOME)/include/python2.7 sudo find / -name'Python.h'

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

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