build時にPython.hがないというエラーが出た時の解決方法
Python.hがどこにあるのかを調べる。
find / -name "Python.h"
/root/.pyenv/versions/miniconda3-4.3.30/include/python3.6m/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/envs/caffe2/include/python3.6m/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/pkgs/python-3.6.5-hc3d631a_2/include/python3.6m/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/pkgs/python-3.6.3-hc9025b9_1/include/python3.6m/Python.h
/root/.pyenv/versions/3.6.5/include/python3.6m/Python.h
/usr/include/python3.6m/Python.h
/usr/include/python2.7/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/envs/caffe2/include/python3.6m/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/pkgs/python-3.6.5-hc3d631a_2/include/python3.6m/Python.h
/root/.pyenv/versions/miniconda3-4.3.30/pkgs/python-3.6.3-hc9025b9_1/include/python3.6m/Python.h
/root/.pyenv/versions/3.6.5/include/python3.6m/Python.h
/usr/include/python3.6m/Python.h
/usr/include/python2.7/Python.h
cmakeのoptionを使ってディレクトリを指定する。
-DPYTHON_INCLUDE_PATH=~/.pyenv/versions/3.6.5/include/python3.6m \
-DPYTHON_INCLUDE_DIR=~/.pyenv/versions/3.6.5/include/python3.6m \
-DPYTHON_INCLUDE_DIRS2=~/.pyenv/versions/3.6.5/include/python3.6m \
-DPYTHON_INCLUDE_DIR=~/.pyenv/versions/3.6.5/include/python3.6m \
-DPYTHON_INCLUDE_DIRS2=~/.pyenv/versions/3.6.5/include/python3.6m \
あるいは最初からシステムのpythonを使ってビルドする。
スポンサーリンク
スポンサーリンク