anaconda3 +caffe-cpu+Ubuntu18.04

直接用 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
  1. ModuleNotFoundError: No module named ‘math’
    https://stackoverflow.com/questions/51052604/importing-datetime-raises-modulenotfound-math-in-python-script-when-executed-b

  2. 进入anaconda环境,import caffe,报错no module named caffe
    把安装包移到anaconda2下面/site-packages

  3. 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,成功了。

  4. 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/caffemaster/build/lib:LD_LIBRARY_PATH $ source /etc/profile # 使环境变量生效 $ echo $<环境变量名> # 查看环境变量

  5. 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 sure

     	pip install protobuf
     	/home/username/anaconda2/bin/pip install protobuf
    
  6. 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/yc1404/article/details/8559852

参考资料:
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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值