zoukankan      html  css  js  c++  java
  • python命令行中import caffe报错的解决方案

    1、ImportError: No module named skimage.io

    >>> import caffe
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "caffe/__init__.py", line 1, in <module>
        from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
      File "caffe/pycaffe.py", line 15, in <module>
        import caffe.io
      File "caffe/io.py", line 2, in <module>
        import skimage.io
    ImportError: No module named skimage.io

    解决方案:

    缺乏skimage工具箱

    pip install scikit-image


    2、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 版本;对于其他的版本,需要自己进行摸索咯。


    3、ImportError: No module named google.protobuf.internal

    解决方案:

    sudo pip install protobuf


    4、ImportError: No module named caffe

    解决方案:把caffe目录下的python目录,添加到环境变量中

    export PYTHONPATH=/work/project/caffe/python:$PYTHONPATH


    参考:https://www.cnblogs.com/wangxiaocvpr/p/6285542.html
  • 相关阅读:
    HTML JS 数据校验
    算法: 实现LRU缓存,读取、写入O(1)实现
    C/C++ 二维数组
    tmux 终端分屏利器使用
    关于Apache Tomcat存在文件包含漏洞的安全公告
    SQLSERVER触发器触发INSERT,UPDATE,DELETE三种状态
    SQL Server 触发器
    SQL Server游标
    SQL Server基础之游标
    阿里maven镜像配置
  • 原文地址:https://www.cnblogs.com/alan666/p/8311832.html
Copyright © 2011-2022 走看看