>>> 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. pandas.io.common.CParserError: Error tokenizing data. C error: Expected 1 fields in line 526, saw 5

    pandas.io.common.CParserError: Error tokenizing data. C error: Expected 1 fields in line 526, saw 5 ...

  2. 1 virtual

    1 differents: 'virtual' just in C# In Java It does't have the keyword 2 Usages in C# used in base cl ...

  3. Java8 异步编排类CompletableFuture

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/ShiJiaqi. https://www.cnblogs.com/shijiaqi1066/p/8758206 ...

  4. Spring boot 问题总结

    1. Spring boot 嵌入的tomcat不能启动: Unregistering JMX-exposed beans on shutdown   在官网(http://start.spring. ...

  5. 关于setInterval的坑

    一道面试题:“setInterval和setTimeout有什么区别” “如果setInterval计时器的回调函数执行完需要5秒,而计时器时间间隔为3秒,那会发生什么?” 验证代码 让程序滞留固定时 ...

  6. Django 自定义

    from django.db import models class MyCharfield(models.Field): def __init__(self,max_length,*args,**k ...

  7. git学习总结 - 纯命令

    全局安装git: npm intall git -g 查看git版本: git --version 进入目录,初始化git: 若在目录中使用上一个,不在目录中使用下一个. //已有目录: git in ...

  8. SpringMVC之JSON交互

    #什么是json? json是一种用于储存数据格式,是js脚本语言的子集. #json的作用? 它可以传递对象.数组等数据结构.如果是单个数据,则要用数组,不用对象,因为对象都是键值对的 方式去存储, ...

  9. Java中五种遍历HashMap的方式

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class Java8Templat ...

  10. win7 powershell配色方案

    首先我是参考微软的word的, look~ Windows PowerShell 配置文件 要配置powershell很简单, 就几步 1.显示 Windows PowerShell 配置文件的路径 ...