caffe之mac下环境搭建
参考
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
caffe之mac下环境搭建的更多相关文章
- Mac OS X下环境搭建 Sublime Text 2 环境变量配置 开发工具配置Golang (Go语言)
Golang (Go语言) Mac OS X下环境搭建 环境变量配置 开发工具配置 Sublime Text 2 一.安装Golang的SDK 在官网http://golang.org/ 直接下载安装 ...
- Mac下docker搭建lnmp环境 + redis + elasticsearch
之前在windows下一直使用vagrant做开发, 团队里面也是各种开发环境,几个人也没有统一环境,各种上线都是人肉,偶尔还会有因为开发.测试.生产环境由于软件版本或者配置不一致产生的问题, 今年准 ...
- Appium+python自动化16-appium1.6在mac上环境搭建启动ios模拟器上Safari浏览器
前言 在mac上搭建appium踩了不少坑,先是版本低了,启动后无限重启模拟器.后来全部升级最新版本,就稳稳的了. 环境准备: 1.OS版本号10.12 2.xcode版本号8.3.2 3.appiu ...
- appium1.6在mac上环境搭建启动ios模拟器上Safari浏览器 转自:上海-悠悠
前言 在mac上搭建appium踩了不少坑,先是版本低了,启动后无限重启模拟器.后来全部升级最新版本,就稳稳的了. 环境准备: 1.OS版本号10.12 2.xcode版本号8.3.2 3.appiu ...
- MAC OpenGL 环境搭建
MAC OpenGL 环境搭建 基础库介绍 先要安装两个库一个是GLEW(OpenGL Extension Wrangler Library),另外一个是GLFW(Graphics Library F ...
- Redis的简单介绍及在Windows下环境搭建
简单介绍 1,Redis是什么 最直接的还是看官方的定义吧. Redis is an open source (BSD licensed), in-memory data structure stor ...
- opencv在vc2010 express下环境搭建方法笔记+空白通用工程(已编译测试通过)(提供下载)
opencv在VC2010 express版本下的环境搭建可以参见下面的wiki,这里面讲的非常清楚. http://wiki.opencv.org.cn/index.php/VC_2010_Expr ...
- Linux下环境搭建(四)——jenkins+gitlab+jmeter实践
经过前三篇博文的介绍,jenkins+gitlab+jmeter接口自动化的框架就搭建成功了,详细可见 Linux下环境搭建(一)——java.tomcat配置 Linux下环境搭建(二)——jenk ...
- Mac Appium环境搭建
安装brew ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" 安装java brew install ...
随机推荐
- PAT Advanced 1023 Have Fun with Numbers (20) [⼤整数运算]
题目 Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, ...
- C++常用库函数 C函数库 cstdio
常用的C/C++函数库, cstdio(stdio.h) 标准输入输出库.C Standard Input and Output Library 1. 实例 #include <cstdio&g ...
- ZJNU 1535 - 新建的大楼--中高级
因为从俯视图看,输入输出的视角是从右下方看向左上方的 所以左上角的正方体最有可能被其他正方体挡住 立体上,底部的正方体最有可能被顶部的正方体挡住 所以绘图应该从后往前,从下往上绘制 剩下的就是一大堆计 ...
- JavaSE--RMI初识
转自:http://blog.csdn.net/guyuealian/article/details/51992182 一.Java RMI机制: 远程方法调用RMI(Remote Me ...
- JavaScript学习笔记 - 进阶篇(7)- 浏览器对象
window对象 window对象是BOM的核心,window对象指当前的浏览器窗口. window对象方法: 注意:在JavaScript基础篇中,已讲解了部分属性,window对象重点讲解计时器. ...
- macbook 一些php相关操作
开启php: https://jingyan.baidu.com/article/67508eb434539f9cca1ce4da.html 配置多虚拟主机: https://jingyan.bai ...
- 如何优雅的设计APP页面?
页面框架设计只是整个产品设计中的一环,不要把眼界局限在这一环,也不要只站需求.只站在交互.只站在视觉上思考问题,从多个角度看问题,你才会学会成长. 产品设计是一个系统工程,单独拧出来其中一个流程来讲, ...
- Python笔记_第一篇_面向过程_第一部分_5.Python数据类型之字典类型(dict)
字典!在Python中字典是另一种可变容器模型,可以存储任意类型的对象.是Python存储数据类型的最高级(maybe). 特点:1. 字典的存储方式和其他类型数据略有不同,是通过键(key)和值(v ...
- LeetCode——264. 丑数 II
编写一个程序,找出第 n 个丑数. 丑数就是只包含质因数 2, 3, 5 的正整数. 示例: 输入: n = 10 输出: 12 解释: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 ...
- Educational Codeforces Round 78 (Rated for Div. 2)B. A and B(1~n的分配)
题:https://codeforces.com/contest/1278/problem/B 思路:还是把1~n分配给俩个数,让他们最终相等 假设刚开始两个数字相等,然后一个数字向前走了abs(b- ...