1、文件caffe-master/python/requirements.txt列举了Caffe依赖的python库,最简单的方法是用pip安装,pip的安装方法:
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py sudo python get-pip.py如果命令不能直接运行,则可以直接打开上面的网站链接,另存为 get-pip.py
然后开始用pip安装刚才的依赖吧:(在caffe-master目录下)
sudo pip install -r python/requirements.txt
2、手动安装
下面是caffe-master/python/requirements.txt的内容(从上到下安装,有些库对上面的库有所依赖):
Cython>=0.19.2
numpy>=1.7.1
scipy>=0.13.2
scikit-image>=0.9.3
matplotlib>=1.3.1
ipython>=1.1.0
h5py>=2.2.0
leveldb>=0.191
networkx>=1.8.1
nose>=1.3.0
pandas>=0.12.0
python-dateutil>=1.4,<2
protobuf>=2.5.0
python-gflags>=2.0
pyyaml>=3.10
Pillow>=2.3.0
以 Cython 为例,手动的话用 sudo pip install Cython 即可,然后在 pip 的过程中有什么问题就相应解决。
3、在 caffe 目录下编译编译Python和Matlab用到的caffe文件
5、遇到的问题:
(1)install scipy problem:
Command /usr/local/opt/python3/bin/python3.3 -c "import setuptools, tokenize;file='/private/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-9r7808-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/scipy Storing debug log for failure in /Users/dan/.pip/pip.log
解决方法:
sudo apt-get install python python-dev libatlas-base-dev gcc gfortran g++
(2)如果 pip 无法正常安装protobuf,则
使用 sudo apt-get install -y python-protobuf 完成对protobuf 的安装。
参考博客:
http://www.cnblogs.com/alfredtofu/p/3577241.html
http://blog.youkuaiyun.com/baobei0112/article/details/43083235(非常好的安装caffe的博客)