>>> import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py", line 13, in <module>
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: dynamic module does not define module export function (PyInit__caffe)
>>>


发现是 Python  3.5 导致的,因为版本较高的 Python 和 caffe 不一定兼容;

  caffe 官网 (http://caffe.berkeleyvision.org/ ) 上也提示说, 只是较好的支持 caffe 2.7 版本;对于其他的版本,需要自己进行摸索咯。呵呵 。。。

那么,就开始安装 Python 2.7 吧,还想什么呢 。。。

安装 Python 2.7 的参考博文:http://blog.csdn.net/mycafe_/article/details/18526479

Python 2.7.3

1. wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

2. tar zxf Python-2.7.3.tgz

3. cd Python-2.7.3

4. ./configure --prefix=/usr/local/python27

  如果不需要保留系统自带的python,可以不带--prefix参数

5. make && make install

6. ln -sf /usr/local/python27/bin/pyhon2.7 /usr/bin/python2.7

使用python2.7时,直接在shell中输入python2.7即可


关于 Python版本的问题解决了,但是出现了新的问题:

>>> import caffe
/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptr<caffe::Net<float> > already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptr<caffe::Blob<float> > already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptr<caffe::Solver<float> > already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
/home/wangxiao/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/io.py", line 8, in <module>
from caffe.proto import caffe_pb2
File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/proto/caffe_pb2.py", line 4, in <module>
from google.protobuf.internal import enum_type_wrapper
ImportError: No module named google.protobuf.internal
>>>

Ok, 目前就是要安装 protobuf.

参考:http://www.tuicool.com/articles/jM7Nn2/

  

编译caffe的Python借口,提示:ImportError: dynamic module does not define module export function (PyInit__caffe)的更多相关文章

  1. ImportError: dynamic module does not define module export function (PyInit__sqlite3)

    使用python3.6 中的django-admin创建项目的时候报错 ImportError: dynamic module does not define module export functi ...

  2. (原+转)win7上编译caffe支持python及matlab

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/7126126.html 参考网址: https://github.com/happynear/caffe ...

  3. python安装提示ImportError: No module named web

    今天在开发一个项目时出现错误,重新安装了一下python和yum,然后面板就无法启动了,提示需要安装web依赖,但是具体是哪个web源呢,pip install web不行 Traceback (mo ...

  4. python执行提示“ImportError: No module named OpenSSL.crypto”

    错误信息如下: Traceback (most recent call last): File "/usr/local/yunanbao/yxz-script/autoops/TaskSer ...

  5. ImportError: dynamic module does not define module export function (PyInit__caffe)

    使用python3运行caffe,报了该错误. 参考网址:https://stackoverflow.com/questions/34295136/importerror-dynamic-module ...

  6. 机器学习caffe环境搭建——redhat7.1和caffe的python接口编译

    相信看这篇文章的都知道caffe是干嘛的了,无非就是深度学习.神经网络.计算机视觉.人工智能这些,这个我就不多介绍了,下面说说我的安装过程即遇到的问题,当然还有解决方法. 说下我的环境:1>虚拟 ...

  7. (原)Ubuntu16中编译caffe

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5797526.html 参考网址: http://caffe.berkeleyvision.org/in ...

  8. Ubuntu16.04安装编译caffe以及一些问题记录

    前期准备: 最好是python虚拟环境 [anaconda的创建虚拟环境] 创建 conda create -n caffeEnv(虚拟环境名字) python=3.6 激活环境 source act ...

  9. Caffe: Caffe的Python接口

    官方参考:http://caffe.berkeleyvision.org/installation.html 官方介绍是这样的: Python The main requirements are nu ...

随机推荐

  1. C#之Action的实际应用例子

    public class DemoAction{ public Action action; public Action<int> action1; public Action<in ...

  2. 常用bash,autoUserAdd.sh

    #!/bin/bash # auth: xiluhua # date: -- read -p "please input a username:" username [ -z $u ...

  3. ClassTwo__HomeWork

    1,素数输出 设计思路声明两个函数分别用来实现输出任意两个数之间所有的素数和任意两个数之间最大最小的十个素数 方法一:一个数的因子不会大于它本身的开方; 方法二:创建一个数组来储存素数并输出最大最小的 ...

  4. GUI界面修饰

    function varargout = GUI20(varargin) % GUI20 MATLAB code for GUI20.fig % GUI20, by itself, creates a ...

  5. Linux 进程管理 ps、top、pstree命令

    ps命令:查看系统中正在运行的进程 ps 是用来静态地查看系统中正在运行的进程的命令.不过这个命令有些特殊,它的部分选项不能加入"-",比如命令"ps aux" ...

  6. redis 的数据结构

    Redis 数据类型 详解见: http://www.runoob.com/redis/redis-strings.html Redis支持五种数据类型:string(字符串),hash(哈希),li ...

  7. jsoi2018 R1R2

    Jsoi2018 R1: D1:T1:签到题,状压dp,(思考:讲题人说可以卡一卡空间,怎么做?) T2:50pts:贪心,因为无重复 100pts:线段树合并? T3:25pts 树形dp D1:T ...

  8. sqlalchemy学习笔记

    https://segmentfault.com/a/1190000006949536

  9. Java学习笔记之Linux下的Java安装和配置

    0x00 概述 由于使用 yum 或者 apt-get 命令 安装 openjdk 可能存在类库不全,从而导致用户在安装后运行相关工具时可能报错的问题,所以此处我们推荐采用手动解压安装的方式来安装 J ...

  10. JDK源码之ReentrantLock

    1.定义 ReentrantLock是一种可重入锁,允许一个线程对同一个资源重复加锁,如果说是当一个线程调用一个锁的lock()方法,然后再次调用锁的lock()方法,当锁不支持可重入时,该线程会被自 ...