mac 下安装caffe(一)
1.brew install --build-from-source -vd boost boost-python
这一步出错:libtool: unrecognized option `-static'
编译过程中调用了"libtool" -static -o "xx.a" "xxx.o" 命令进行静态链接。
MERRICKMEI-MB0:/ merrickmei$ brew unlink libtool
Unlinking /usr/local/Cellar/libtool/2.4.6_1... symlinks removed
MERRICKMEI-MB0:/ merrickmei$ which libtool
/usr/local/bin/libtool
MERRICKMEI-MB0:/ merrickmei$ whereis libtool
/usr/bin/libtool MERRICKMEI-MB0:/ merrickmei$ /usr/local/bin/libtool -static -o
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information. MERRICKMEI-MB0:/ merrickmei$ /usr/bin/libtool -static -o
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: missing argument to: -o option
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols] MERRICKMEI-MB0:/ merrickmei$ ls -l /usr/local/bin/libtool
-rwxrwxrwx root admin : /usr/local/bin/libtool
可见,/usr/local/bin/libtool不支持-static,而/usr/bin/libtool支持-static选项。
参考:https://github.com/Homebrew/legacy-homebrew/issues/28442
MERRICKMEI-MB0:/ merrickmei$ /usr/local/bin/libtool --version
ltmain.sh (GNU libtool) 2.2.6b
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, /usr/local/bin/libtool 是之前自己make install手动编译安装的。
而/usr/bin/libtool 是xcode自带的。 同样make uninstall libtool:
cd libtool-2.2.6b
./configure --prefix=/usr/local
make
sudo make uninstall 虽然有错误,但是/usr/local/bin/libtool 已经不见了。which libtool,whereis libtool都只显示/usr/bin/libtool
再次执行brew install --build-from-source -vd boost boost-python 就发现ok了,continue...
2.Python接口,进入caffe/python目录
for req in $(cat requirements.txt); do pip install $req; done
3.make
Makefile.config中去掉CPU_ONLY := 1的注释
cp Makefile.config.example Makefile.config
make all
make test
make runtest
make runtest出现绿色RUN OK
4.pycaffe
MERRICKMEI-MB0:caffe merrickmei$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp::: fatal error: 'numpy/arrayobject.h' file not found
#include <numpy/arrayobject.h>
解决:将numpy/arrayobject.h所在的路径/usr/local/lib/python2.7/site-packages/numpy/core/include 添加到
Makefile.config中的PYTHON_INCLUDE
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include\
/usr/local/lib/python2.7/site-packages/numpy/core/include
再次 make clean,make pycaffe,成功编译。。
添加caffe到PYTHONPATH
export PYTHONPATH=$PYTHONPATH:/Users/work/gitclone/caffe/python
merrickmei$ python
Python 2.7. (default, Jul , ::)
[GCC 4.2. Compatible Apple LLVM 8.0. (clang-800.0.)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe as cf
python(,0x7fffc7e083c0) malloc: *** malloc_zone_unregister() failed for 0x7fffc7dfe000
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/Users/work/gitclone/caffe/python/caffe/__init__.py", line , in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/Users/work/gitclone/caffe/python/caffe/pycaffe.py", line , in <module>
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: numpy.core.multiarray failed to import
http://stackoverflow.com/questions/33859531/runtimeerror-module-compiled-against-api-version-a-but-this-version-of-numpy-is
>>> import numpy as n
>>> n.__path__
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy']
>>> import sys
>>> sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")
>>> import numpy
>>> print numpy.__path__
['/usr/local/lib/python2.7/site-packages/numpy']
numpy解决后再import caffe 有碰到错误:
ImportError: No module named skimage.io
因为使用的系统的python,而不是Anaconda Python,决定还是用Anaconda Python
参考:http://www.tuicool.com/articles/FjAnqin
mac 下安装caffe(一)的更多相关文章
- mac 下安装caffe(二)
使用Anaconda Python 1.brew edit opencv args << "-DPYTHON_LIBRARY=#{py_lib}/libpython2.7.#{d ...
- Mac 下安装Jenkins
Mac 下安装Jenkins 开始 Jenkins是一个基于Java开发的一种持续集成工具,用于建工持续重复的工作,功能包括: 持续的软件版本发布/测试项目 监控外部调用执行的工作. 近期打算搭建自动 ...
- MAC下安装与配置MySQL
MAC下安装与配置MySQL MAC下安装与配置MySQL 一 下载MySQL 访问MySQL的官网http://www.mysql.com/downloads/ 然后在页面中会看到“MySQL ...
- Mac下安装UPnP Inspector
由于工作中需要用到UPnP Inspector这个工具,而这个工具在windows下安装非常简单,在Mac下安装却很麻烦,在此记录安装流程. 这个工具依赖于两个其他的库:Coherence(一个DLN ...
- Mac下安装Wireshark,双击闪退
Mac OS X上使用Wireshark抓包(http://blog.csdn.net/phunxm/article/details/38590561) Mac下安装Wireshark /Appli ...
- Mac下安装zshell
Mac 下安装zshell 什么是shell 大多数命令行用户接触最多的是Bash,因为Bash是各个版本操作系统(Linux&Mac)的默认shell. 查看当前使用的shell $ ech ...
- 【高可用HA】Apache (1) —— Mac下安装Apache Httpd到自定义路径(非/etc/apache2)
Mac下安装Apache Httpd httpd版本: httpd-2.4.17 参考来源: Tomcat Clustering - A Step By Step Guide Apache HTTP ...
- 《OD大数据实战》mac下安装nginx+php
一.mac安装nginx + php + php-fpm 或apache + php 1. Mac 下 Nginx.MySQL.PHP-FPM 的安装配置 2. Mac下安装LNMP(Nginx+P ...
- Mac下安装HBase及详解
Mac下安装HBase及详解 1. 千篇一律的HBase简介 HBase是Hadoop的数据库, 而Hive数据库的管理工具, HBase具有分布式, 可扩展及面向列存储的特点(基于谷歌BigTabl ...
随机推荐
- text-shadow的用法详解
1.兼容性:text-shadow 和 box-shadow 这两个属性在主流现代浏览器上得到了很好的支持( > Chrome 4.0, > Firefox 3.5, > Safar ...
- Git——github基本操作
基本概念 上一篇文章写到git共享仓库,但是有个局限性,就是这个仓库存在于本地,其他人无法从我们这个仓库拿到共享的内容 但是我们可以将这个共享仓库放入一个远程的服务器上,然后设置一些登录权限就能完美的 ...
- RocketMQ学习笔记(13)----RocketMQ的Consumer消息重试
1. 概念 Producer端重试: 生产者端的消息失败,也就是Producer往MQ上发消息没有发送成功,比如网络抖动导致生产者发送消息到MQ失败. 这种消息失败重试我们可以手动设置发送失败重试的次 ...
- SpringBoot中如何使用jpa和jpa的相关知识总结
jpa常用的注解: 注解 解释 @Entity 声明类为实体或表. @Table 声明表名. @Basic 指定非约束明确的各个字段. @Embedded 指定类或它的值是一个可嵌入的类的实例的实体的 ...
- 05Servlet example
dgdfgdfggggggg Servlet 表单数据 在客户端,GET通过URL提交数据,数据在URL中可见:POST把数据放在form的数据体内提交.GET提交的数据最多只有1024字节:POST ...
- Android 按钮常用点击事件大总结
很多学习Android程序设计的人都会发现每个人对代码的写法都有不同的偏好,比较明显的就是对控件响应事件的写法的不同.因此本文就把这些写法总结一下,比较下各种写法的优劣,希望对大家灵活地选择编码方式可 ...
- Xcode5编译ffmpeg
命令行安装FFmpeg:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg(或:到https://github.com/gabriel/ffmpeg ...
- 自定义属性Attribute的运用
有时候需要一个枚举类,能够承载更多的信息,于是可以利用attribute这个特性. 首先编写自己业务需求类 [AttributeUsage(AttributeTargets.Field)] publi ...
- 集合:ListIterator
why ? when ? how ? what ? Java 集合框架图 有了 Iterator 为什么还要有 ListIterator 呢? Iterator 遍历的时候如果你想修改集合中的元素怎么 ...
- lua排序算法
SEED = ; --随机序列 可任取 NUM = ; --排序规模 --随机序列 初始数据 function GenRnd( seed, n ) --生成随机数 data = {}; local r ...