Caffe安裝
參照 Caffe Ubuntu Installation 和 Ubuntu 14.04上安裝caffe 即可
Caffe測試
測試Caffe是否正常
進入 Caffe 主文件夾下
sh data/mnist/get_mnist.sh
sh examples/mnist/create_mnist.sh
sh examples/mnist/train_lenet.sh
Problem & Solution
Problem_0
The program 'protoc' is currently not installed. You can install it by typing:
sudo apt-get install protobuf-compiler
但是 sudo apt-get install protobuf-compiler
的時候又顯示 protobuf-compiler 已經安裝了
原因是protoc 未添入環境變量中
Solution
Problem_1
:~/Software/Caffe$ make all -j8
PROTOC src/caffe/proto/caffe.proto
make: protoc: Command not found
CXX src/caffe/common.cpp
make: *** [.build_release/src/caffe/proto/caffe.pb.h] Error 127
make: *** Waiting for unfinished jobs....
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
from ./include/caffe/common.hpp:19,
from src/caffe/common.cpp:7:
./include/caffe/util/cudnn.hpp:8:34: fatal error: caffe/proto/caffe.pb.h: No such file or directory
compilation terminated.
make: *** [.build_release/src/caffe/common.o] Error 1
原因是 protoc 未添入 環境變量 中
Solution
個人實際操作中,
protoc 用的是 protobuf 發行版 上的 protobuf-python-3.0.0.tar.gz
‘ ./autogen.sh ’ 執行不了,故沒執行;
‘ ./configure --prefix=/usr/local/protobuf ’ 執行了。
Problem_2
google protobuf 出問題
Solution
在官網上可以下載 Protobuf 的源代碼。然后解壓編譯安裝便可以使用它了。
安裝步驟舉例如下:
tar -xzf protobuf-2.1.0.tar.gz
cd protobuf-2.1.0
./configure --prefix=/usr/local/protobuf
make
make check
make install
添加 protobuf路徑 至 環境變量 中 :
sudo vim /etc/profile
添加
export PATH=$PATH:/usr/local/protobuf/bin/ export
PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
保存之
source /etc/profile
同時, 也要在 ~/.profile 中添加上面兩行代碼,
否則會出現 登錄用戶找不到protoc命令
配置動態鏈接庫路徑 :
sudo vim /etc/ld.so.conf
插入:
/usr/local/protobuf/lib
su #root 權限
ldconfig
記得要去python文件夾內(protobuf-2.1.10/python安裝包下)安裝python所需要的模塊
sudo python setup.py build
sudo python setup.py test
sudo python setup.py test
完成后,驗證是否安裝成功
protoc --version
驗證python模塊是否安裝成功
python
import google.protobuf
如果沒有報錯,則說明安裝正常