【发布时间】:2017-10-27 18:33:43
【问题描述】:
我想将 caffe 导入我的 python 2.7 (anaconda/mac)。我设法完成了制作(全部、测试和运行测试),都成功通过了。这是 make runtest 命令的 sn-p:
[----------] Global test environment tear-down
[==========] 1096 tests from 150 test cases ran. (49316 ms total)
[ PASSED ] 1096 tests.
下一步根据caffe manual运行命令:
make pycaffee
我得到了错误:
make: *** 没有规则来制作目标 `python/caffe/_caffe.cpp',需要 'python/caffe/_caffe.so'。停下来。
我认为这与 pythonpath 有关,但是我无法弄清楚我缺少什么。
这是我的 bash_profile:
export PATH="//anaconda/bin:$PATH" 导出
PATH="/home/XXX/anaconda/bin:$PATH" 导出
PYTHONPATH=~/Desktop/Google_deepDream/caffe-master/python:$PYTHONPATH
另外,我的一部分 makefile 看起来像:
# 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 nin root.
ANACONDA_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
我也有所有的python依赖:
for req in $(cat requirements.txt); do pip install $req; done
【问题讨论】:
-
设置
PYTHONPATH的bash_profile 命令可能无法正确解释~。尝试回显$PYTHONPATH并查看它是否具有正确的值。 (虽然我不确定这会如何影响make。) -
@JohnGordon 谢谢,但 pythonpath 似乎是正确的。完成后 echo $PYTHONPATH 我得到了正确的输出。
标签: python c++ debugging caffe