尽管在系统中有它,但无法找到Python.h(Ubuntu 16)

时间:2018-02-18 22:07:16

标签: python-3.x compilation anaconda ubuntu-16.04

我有Anaconda 3.6并且我正在尝试编译Pycaffe(来自Caffe框架),但是我收到以下错误:

python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory

我已经使用sudo apt-get install python3.6-dev安装了特定于Python 3.6的python-dev软件包,当我运行locate Python.h时,它返回:

/home/jdevezas/.local/share/Trash/info/Python.h.trashinfo
/home/jdevezas/anaconda/bin/Python.h
/home/jdevezas/anaconda/include/python3.6m/Python.h
/home/jdevezas/anaconda/pkgs/python-3.6.0-0/include/python3.6m/Python.h
/home/jdevezas/anaconda/pkgs/python-3.6.4-hc3d631a_1/include/python3.6m/Python.h
/usr/include/python2.7/Python.h
/usr/include/python3.5m/Python.h
/usr/lib/llvm-3.5/include/lldb/Interpreter/ScriptInterpreterPython.h

Anaconda文件夹的正确PATH在我的.bashrc文件中指定:

export PATH="home/jdevezas/anaconda/bin:$PATH"

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我不确定您是否遇到相同的问题,但就我而言。

通过-

安装python-dev软件包后
sudo apt-get install python3-dev 
sudo apt-get install python3.5-dev
sudo apt-get install python3.6-dev 

我已经安装了python3.6,但默认设置是指向python3.5

# 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 \

您可以确认吗?