【发布时间】:2018-02-17 14:55:57
【问题描述】:
在安装了 Anaconda 3.6 的 Ubuntu 16.04 上尝试编译 pycaffe 时,出现以下错误:
python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory
我尝试安装 python-devel 软件包
sudo apt-get install python3-dev
sudo apt-get install python3.5-dev
sudo apt-get install python3.6-dev
但即使分别尝试了其中的每一个,也会出现相同的错误。
.bashrc 中似乎添加了正确的 PATH
export PATH="home/jdevezas/anaconda/bin:$PATH"
在 Caffe 的 makefile.config 中我有
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
#PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := /home/jdevezas/anaconda
#PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python2.7 \
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
# Uncomment to use Python 3 (default is Python 2)
PYTHON_LIBRARIES := boost_python3 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
/usr/lib/python3.5/dist-packages/numpy/core/include
我也尝试过使用 Python 2.7,但没有结果。有什么建议吗?
【问题讨论】:
-
我的解决方案是手动添加到包含路径/usr/include/python3.5
标签: python-3.x ubuntu-16.04 pycaffe