前言
Ubuntu16安装caffe过于繁琐,然而Ubuntu18安装起来却仅仅两步而已
附上官方安装教程:http://caffe.berkeleyvision.org/install_apt.html
安装方法
1、众所周知,访问国外网时很慢很慢,所以首先需要换源,这里建议使用中科大的源,因为用国内其他源可能无法检测到Caffe。(这里坑了我好久)
cp /etc/apt/sources.list /etc/apt/sources_init.list
gedit /etc/apt/sources.list
将弹出的文本全部改成
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
2、执行更新
sudo apt-get update
sudo apt-get upgrade
3、安装Caffe
sudo apt install caffe-cpu
如果想安装gpu版,则将-cpu改成-cuda即可
4、编译
sudo apt build-dep caffe-cpu
同样,gpu版需自行更改为-cuda
5、最后验证下是否成功即可