1、下载anaconda
查看ubuntu是32位还是64位
命令:
uname -m
如果显示i686,你安装了32位操作系统
如果显示 x86_64,你安装了64位操作系统
uname -a 查看更多内容
2、安装
bash Anaconda2-4.2.-Linux-x86_64.sh
一路默认,然后配置环境
sudo gedit ~/.bashrc
export PATH="/home/nxp/anaconda2/bin:$PATH" anaconda安装
source ~/.bashrc
3、验证
conda list
没有错误,则配置好了。
换源,下载速度加快
pip
win下文件路径:C:\Users\你的用户名\pip\pip.ini
linux下文件路径:~/.pip/pip.conf
内容:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
conda
命令行下两条命令即可
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
创建环境
conda create -n testcaffe python=2.7
进入环境
source activate testcaffe
退出环境
source deactivate
下载caffe
注释掉系统目录
#PYTHON_INCLUDE := /usr/include/python2.7 \
#/usr/lib/python2.7/dist-packages/numpy/core/include
打开Anaconda目录
# 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.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
# Uncomment to use Python 3 (default is Python 2)
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
# /usr/lib/python3.5/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
看看PYTHONPATH变量,把当前caffe中python路径 加到~/.bashrc中
编译caffe
make all -j8
make pycaffe
make test -j8
make runtest -j8
也许你在编译runtest的时候,会报这样的错误:
.build_release/test/test_all.testbin: error while loading shared libraries: libhdf5.so.10: cannot open shared object file: No such file or directory
进入/usr/lib/x86_64-linux-gnu看一下,你的libhdf5.so.x中的那个x是多少,比如我的是libhdf5.so.7
# cd /usr/lib/x86_64-linux-gnu
# sudo ln -s libhdf5.so.7 libhdf5.so.10
# sudo ln -s libhdf5_hl.so.7 libhdf5_hl.so.10
# sudo ldconfig
conda install protobuf
运行
jupyter notebook
终端直接运行jupyter notebook