• 编译caffe的Python借口,提示:ImportError: dynamic module does not define module export function (PyInit__caffe)


    >>> 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/

     

        

     

  • 相关阅读:
    (一)Oracle学习笔记—— 表和表空间
    svn上检出的项目在myeclipse中报错的解决
    创建表空间报错
    PLSQL中scott账户登录不上,报错ORA-01017: invalid username/password; logon denied
    Oracle安装过程中的几点注意
    Refactoring之——代码的坏味道(二)过大的类 &(三)基本类型偏执
    Refactoring之——代码的坏味道(一)过长方法
    (一)Activiti之——简介、插件安装及BPMN元素
    用尽洪荒之力整理的Mysql数据库32条军规(转)
    技术文章翻译
  • 原文地址:https://www.cnblogs.com/wangxiaocvpr/p/6285542.html
Copyright © 2020-2023  润新知