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 ...
随机推荐
- 吴裕雄--天生自然ShellX学习笔记:Shell 数组
数组中可以存放多个值.Bash Shell 只支持一维数组(不支持多维数组),初始化时不需要定义数组大小(与 PHP 类似). 与大部分编程语言类似,数组元素的下标由0开始. Shell 数组用括号来 ...
- LGOJ3879 TJOI2010 阅读理解
不可否认,\(TJOI\)的这道题确实不难 为本题写博客的唯一原因就是 \(STL\)大法好!!!! Description link 不简述题意了,因为实在是简单 Solution 直接\(map& ...
- QeePHP
百度百科: https://baike.baidu.com/item/qeephp/8328612?fr=aladdin 官方地址: http://www.qeephp.cn/app/index.ph ...
- 常用STL的常见用法
//#pragma comment(linker, "/STACK:1024000000,1024000000") //#pragma GCC optimize(2) //#inc ...
- 使用iTextSharp來合併PDF檔
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...
- Mac下Rblas配置
Mac 下加速 R做矩阵计算, 感觉比没有R open 快, 但数量级上差不多了. 安装R open时,提示 X11相关的组件缺失,不想再额外安装,怕污染系统文件. cd /Library/Frame ...
- android studio 导入eclipse项目后的报错解决
1.如何导入: 2.导入的时候会让你创建gradle,一直下一步,不用修改 3.编译, a.会报编码格式错误,如果有中文会报这个错,修改成utf-8 b.找不到类,解决办法 右键工程 引入外部的包,重 ...
- More 'long-life' plastic bags being used
1 1.1 roll out v. 推广,或实行 1.2 pilot v. 试行 n. 飞行员 1.3 bags for life 可重复使用的环保购物袋 2 2.1 How many times a ...
- i2c驱动dht12的原理和步骤
一.步骤 1.首先匹配i2c的控制器设备和控制器驱动,会生成一个struct i2c_adapter对象, 2.根据i2c_board_info ,在 arch/arm/mach-sunxi/s ...
- pycharm、Django+node.js、vue搭建web项目
参考文章:https://www.wandouip.com/t5i35466/ 在此感谢 本篇接着上一篇:windows10使用npm安装vue.vue-cli 首先Django项目是搭建好的,就是 ...