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 ...
随机推荐
- 如何实现MVC ActionResult 返回类型为JavaScriptResult
必需的js引用文件 <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>@Scripts ...
- Spring Cloud Hystrix熔断器隔离方案
Hystrix组件提供了两种隔离的解决方案:线程池隔离和信号量隔离.两种隔离方式都是限制对共享资源的并发访问量,线程在就绪状态.运行状态.阻塞状态.终止状态间转变时需要由操作系统调度,占用很大的性 ...
- nginx中server块的匹配顺序
客户端发出一个http请求时,nginx收到后会取出header头中的host,与nginx.conf中每个server的server_name进行匹配,以此决定到底由哪一个server块来处理这个请 ...
- LGOJ1344 追查坏牛奶
Description link 题意概述:给一张图,每条边有边权,求让点 \(1\) 和点 \(n\) 不连通的"最小破坏边权和" 和 "在此基础上的最小破坏边数&qu ...
- unity学习 5.x依赖打包和解包
unity5已经封装好了接口,所以依赖打包并没有那么神秘和复杂了. 打包: 1.定义好资源的assetBundleName 2.BuildPipeline.BuildAssetBundles,指定资源 ...
- linux安装java步骤
本文转发自博客园-Q鱼丸粗面Q.博客园-郁冬的文章,内容略有改动 本文已收录至博客专栏linux安装各种软件及配置环境教程中 方式一:yum方式下载安装 1.查找java相关的列表 yum -y li ...
- c++语法(1)
#include<iostream> #include<windows.h> using namespace std; class Parents { public: ; // ...
- POJ 3273 Monthly Expense二分查找[最小化最大值问题]
POJ 3273 Monthly Expense二分查找(最大值最小化问题) 题目:Monthly Expense Description Farmer John is an astounding a ...
- Microsoft .NET Framework 4.5.2 (Offline Installer)
Microsoft .NET Framework 4.5.2 (Offline Installer) for Windows Vista SP2, Windows 7 SP1, Windows 8, ...
- Spring加载xml配置文件的方式
梳理Spring的流程 xml是最常见的spring 应用系统配置源.Spring中的几种容器都支持使用xml装配bean,包括: XmlBeanFactory,ClassPathXmlApplica ...