直接用 sudo apt install caffe-cpu 安装caffe的坑
最好用anaconda2, python3.7不支持
sudo apt install caffe-cpu
git clone https://github.com/BVLC/caffe.git
cp Makefile.config.example Makefile.config
#打开Makefile.config文件,CPU_ONLY := 1
make pycaffe
sudo gedit /etc/profile
##末尾添加: export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH用完整路径
source /etc/profile
https://blog.csdn.net/subiluo/article/details/78559001
https://blog.csdn.net/forest_world/article/details/51371560
-
ModuleNotFoundError: No module named ‘math’
https://stackoverflow.com/questions/51052604/importing-datetime-raises-modulenotfound-math-in-python-script-when-executed-b -
进入anaconda环境,import caffe,报错no module named caffe
把安装包移到anaconda2下面/site-packages -
ModuleNotFoundError: No module named ‘caffe._caffe’
实际上_caffe指的是/usr/lib/python3/dist-package/caffe/_caffe.cpython-36m-x86_64-linux-gnu.so
没错是个so文件,名称是缩写的。问题python环境,于是把3.7降级到3.6.6,成功了。 -
ImportError: No module named _caffe
#设置环境变量 $ sudo gedit /etc/profile # 添加环境变量: export PYTHONPATH= H O M E / c a f f e m a s t e r / d i s t r i b u t e / p y t h o n : {HOME}/caffemaster/distribute/python: HOME/caffemaster/distribute/python:PYTHONPATH export LD_LIBRARY_PATH= H O M E / c a f f e − m a s t e r / b u i l d / l i b : {HOME}/caffe-master/build/lib: HOME/caffe−master/build/lib:LD_LIBRARY_PATH $ source /etc/profile # 使环境变量生效 $ echo $<环境变量名> # 查看环境变量 -
ImportError: No module named google.protobuf.internal
https://stackoverflow.com/questions/37666241/importing-caffe-results-in-importerror-no-module-named-google-protobuf-interna
This is probably because you have two python environments in your machine, the one provided by your linux distribution(pip) and the other by the anaconda environment (/home/username/anaconda2/bin/pip).
Try installing protobuf for both environments to be surepip install protobuf /home/username/anaconda2/bin/pip install protobuf
-
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.2.0-29-generic with 1.
dpkg:处理 initramfs-tools (–configure)时出错:
子进程 已安装 post-installation 脚本 返回了错误号 1
在处理时有错误发生:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
参考资料:
https://blog.csdn.net/qq_41943402/article/details/80990649
https://blog.csdn.net/zziahgf/article/details/72900948
https://blog.csdn.net/forest_world/article/details/51371560
https://blog.csdn.net/subiluo/article/details/78559001
cd caffe
cp Makefile.config.example Makefile.config
and change setting in Makefile.config
mkdir build
cd build
cmake …
./configure (??not sure??)
make all