参考

http://www.linuxidc.com/Linux/2016-09/135026.html

1. 安装brew,也叫homebrew,mac下类似于ubuntu的apt-get功能

curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
brew update

2. 安装git包,包含gitk,(注:brew doctor可以用来诊断brew)

a. 安装git
brew install git b. 安装OpenBlas
brew install homebrew/science/openblas c. 安装Caffe的依赖库,在终端输入如下命令:
for x in snappy leveldb gflags glog szip hdf5 lmdb homebrew/science/opencv;
do
brew uninstall $x;
brew install --fresh -vd $x;
done
brew uninstall --force protobuf; brew install --with-python --fresh -vd protobuf
brew uninstall boost boost-python; brew install --fresh -vd boost boost-python
Info1:
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local

3. 解决retina屏下gitk模糊的问题

# sudo chmod a+w /System/Library/Frameworks/Tk.framework/Versions/Current/Resources/Wish.app/Contents/Info.plist

# vim /System/Library/Frameworks/Tk.framework/Versions/Current/Resources/Wish.app/Contents/Info.plist 

添加

 <!-- support retina screen, xiaxing -->
  <key>NSHighResolutionCapable</key>
  <true/>

生效

# touch /System/Library/Frameworks/Tk.framework/Versions/Current/Resources/Wish.app

4. 安装Xcode,caffe编译依赖很多库,xcode可以提供,从官方AppStore安装即可。

5. 下载caffe工程,配置编译环境

git clone https://github.com/BVLC/caffe
cd <..>/caffe
cp Makefile.config.example Makefile.config // 拷贝生成我们使用的config文件

6. 修改Makefile.config文件,以下是我修改的部分,仅供参考:

# 我的电脑不支持GPU编译,选择CPU ONLY的编译选项

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY :=
# 我的OpenCV版本为2.X,所以注视掉此行

# Uncomment if you're using OpenCV 3
# OPENCV_VERSION :=
# 我的python环境是Anaconda,打开对应注释

# 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. \
/usr/lib/python2./dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := $(HOME)/anaconda2
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python2. \
$(ANACONDA_HOME)/lib/python2./site-packages/numpy/core/include # Uncomment to use Python (default is Python )
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
# /usr/lib/python3./dist-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

7. 编译

# make all
# make test
# make runtest

8. 编译python wrapper

# make pycaffe

Error记录

Error 1.  <resolved, 从AppStore安装Xcode>
-------------------------------------------------------------------------------------------------------------------
0000095573:caffe xiaxing$ make all
ls: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/: No such file or directory
CXX src/caffe/blob.cpp
In file included from src/caffe/blob.cpp::
In file included from ./include/caffe/util/math_functions.hpp::
./include/caffe/util/mkl_alternate.hpp::: fatal error: 'cblas.h' file not found
#include <cblas.h>
^
error generated.
make: *** [.build_release/src/caffe/blob.o] Error
:caffe xiaxing$

Error 2.  <# make pycaffe出错>

0000095573:caffe xiaxing$ make pycaffe


CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp


python/caffe/_caffe.cpp:10:10: fatal error: 'numpy/arrayobject.h' file not found


#include <numpy/arrayobject.h>


1 error generated.


make: *** [python/caffe/_caffe.so] Error 1

Error 3. 
.build_release/test/test_all.testbin --gtest_shuffle --gtest_filter="-*GPU*"
dyld: Library not loaded: @rpath/libhdf5_hl..dylib
Referenced from: /Users/xiaxing/Desktop/baidu/caffe/caffe/.build_release/test/test_all.testbin
Reason: image not found
make: *** [runtest] Trace/BPT trap: 5 解决:
install_name_tool -add_rpath '/Users/work/anaconda/lib'  /Users/work/gitclone/caffe/.build_release/tools/caffe
Error .  test_all.testbin 继续出错-->
dyld: Library not loaded: @rpath/libhdf5_hl..dylib
Referenced from: /Users/work/gitclone/caffe/.build_release/test/test_all.testbin
Reason: image not found 解决:
install_name_tool -add_rpath '/Users/work/anaconda/lib' /Users/work/gitclone/caffe/.build_release/test/test_all.testbin

最新文章

  1. Http、Https请求工具类
  2. pytho简单爬虫_模拟登陆西电流量查询_实现一键查询自己的校园网流量
  3. 详解javascript,ES5标准中新增的几种高效Object操作方法
  4. Java并发编程核心方法与框架-Executors的使用
  5. document.all的详细解释(document.all基本上所有浏览器可用!)
  6. 【SSH】 之 Struts2环境搭建及简单应用开发
  7. VS2012解决方案的设置
  8. Linux系统下Apache2.4.17的安装过程
  9. Swift-08-闭包引起的循环强引用
  10. spring 知识梳理
  11. [MongoDB] Query, update, index and group
  12. Excel 内容粘贴到DataGridView, DataGridView 粘贴到 Excel
  13. 轻松学习Ionic (二) 为Android项目集成Crosswalk(更新官方命令行工具)
  14. CAD2014启动出现loadlibrary failed with error 87
  15. 手机开机提示SD卡受损
  16. eclipse 配置ssh
  17. 计蒜客 2017 NOIP 提高组模拟赛(四)Day1 T2 小X的密室
  18. java 集合类Array、List、Map区别和优缺点
  19. springMVC怎么接受前台传过来的多种类型参数?(集合、实体、单个参数)
  20. java.lang.IllegalStateException: Ambiguous mapping found

热门文章

  1. ElasticSearch使用小结
  2. Nginx安全优化
  3. 61)普通类的.h和.cpp分离
  4. win10系统开发环境安装studio 3T(MongoDB桌面客户端)
  5. 微信小程序2048开发进度(二)
  6. Linux-exec族函数
  7. Comet OJ - Contest #3 D可爱的菜菜子(线段树+线性基的合并)
  8. 关于ebay平台接口(php)对接示例
  9. swoole使用内存
  10. Golang解析json的几种方法