zoukankan      html  css  js  c++  java
  • 使用keras时出现 `pydot` failed to call GraphViz的解决办法

    问题来源于使用了 keras.utils.plot_model,报错内容为:

    2018-08-29 08:58:21.937037: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
    /home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/keras/engine/saving.py:269: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.
      warnings.warn('No training configuration found in save file: '
    Traceback (most recent call last):
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/pydot.py", line 1861, in create
        stderr=subprocess.PIPE, stdout=subprocess.PIPE)
      File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 26, in _check_pydot
        pydot.Dot.create(pydot.Dot())
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/pydot.py", line 1867, in create
        raise OSError(*args)
    FileNotFoundError: [Errno 2] "dot" not found in path.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/you/Documents/workspace/PycharmProjects/venv/src/test.py", line 8, in <module>
        plot_model(model, to_file=MODEL_PNG)
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 132, in plot_model
        dot = model_to_dot(model, show_shapes, show_layer_names, rankdir)
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 55, in model_to_dot
        _check_pydot()
      File "/home/you/Documents/workspace/PycharmProjects/venv/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 29, in _check_pydot
        '`pydot` failed to call GraphViz.'
    OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH.
    
    Process finished with exit code 1
    

      第一反应是pip3 install graphviz,但安装完后依然不好使。

           后来查官网可以使用apt install graphviz,问题解决。

  • 相关阅读:
    shell下如何删除文件的某一列
    git如何列出最简短的commit(tag和head名都不显示)
    git如何列出每次提交对应有哪些文件被修改
    linux下如何使用命令行配置网络
    64bit ubuntu如何使能安装32bit软件
    linux下如何查看当前机器提供了哪些服务
    vi如何修改注释颜色
    uboot启动提示Error, wrong i2c adapter 0 max 0 possible后卡住了怎么办
    linux 如何改变文件属性与权限1
    Linux文件系统只读Read-only file system的解决方法
  • 原文地址:https://www.cnblogs.com/hutao722/p/9552246.html
Copyright © 2011-2022 走看看