为DeepDream或其他有深度的项目,搭建咖啡厅的环境。
我安装了PyCaffe所需的软件包,并将PYTHONPATH设置为caffe/python。
但是,当我在python上导入caffe时:
import caffe作为below.How出现错误以解决此问题?
Segmentation fault: 11发布于 2016-06-03 22:54:02
你用的是mac电脑吗?我很难在mac上制作pycaffe,直到我意识到所有mac上都安装了原生python,并且我使用的是我安装的另一个版本。在编译时,caffe使用了原生python中的一些内容,以及其他python中的一些内容。我必须确保更改makefile.config文件中的所有相关路径,并更改我的bash使用的python。我也推荐在虚拟环境中工作。This是一个很好的帮助你的链接,祝你好运!
发布于 2017-12-01 11:54:36
自2015年以来,Github issue一直在讨论这个问题。最主要的原因是自制的python和OS系统python的冲突。
Homebrew提供了一个awesome solution for OS X
$ python -V # system Python interpreter
$ python2 -V # Homebrew installed Python 2 interpreter
$ python3 -V # Homebrew installed Python 3 interpreter (if installed)因此,解决方案是将所有python路径更改为python2。Bellowing是与我的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
# ------ For Homebrew installed python. Numpy path is added using python commands.
PYTHON_INCLUDE := /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/include/python2.7
# We need to be able to find libpythonX.X.so or .dylib. ------ (Update Homebrew path)
# PYTHON_LIB := /usr/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib
PYTHON_LIB := /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib
# Homebrew installs numpy in a non standard path (keg only) ------ (python2 for brew instead of python for system)
PYTHON_INCLUDE += $(dir $(shell python2 -c 'import numpy.core; print(numpy.core.__file__)'))/include
PYTHON_LIB += $(shell brew --prefix numpy)/lib
# ...发布于 2016-02-18 02:20:31
如果没有看到名为caffe的模块错误,请尝试在python脚本中手动设置python路径
例如。导入sys
sys.path.insert(0,"/home/nviso/GitHub/caffe/distribute/python")
导入咖啡因
这通常适用于我。手动将caffe或python路径添加到.bashrc可能也会解决这个问题,但不确定,现在不要让我的Office PC尝试:)
https://stackoverflow.com/questions/35461536
复制相似问题