mac下import caffe崩溃

mac系统:10.12.6

python:自己安装,非mac自带python

前置条件:编译pycaffe成功

问题:import caffe执行时候崩溃Segmentation fault...

Process:              Python [15242] 
Path:                  /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python 
Version:              2.7.13 (2.7.13) 
CodeType:            X86-64 (Native) 
ParentProcess:        bash [3757] 
Responsible:          Python [15242] 
User ID:              501 

解决方案:网上解决的一大堆,但是大都无法真正解决。主要原因在于mac自带python和自己装的python在编译和运行时冲突了,打开 Makefile.config,做出如下修改

PYTHON_LIB := /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib 

然后重新编译代码:

$ make clean 
$ make 
$ make pycaffe 
$ make distribute 

测试代码:

import sys
caffe_root = '/Users/XXX/caffe/' 
sys.path.append(caffe_root + 'python') 
import caffe
若出现如下错误,

import skimage.io ImportError: No module named skimage.io

可能是没有安装skimage.io 模块,用以下的命令来安装:

$ sudo pip install scikit-image
总而言之,mac + python + caffe 就是蛋疼....... Orz...


python 突然报错 src/tcmalloc.cc:331] Attempt to free invalid pointer 0x7fcca4d01a00 [1....

尝试更换一下import的顺序,把import caffe 尽量提前

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值