Ubuntu系统下python模块graphviz运行报错:graphviz.backend.execute.ExecutableNotFound: failed to execute PosixPath(‘dot‘)

代码中需要运行python模块graphviz,安装:

pip install graphviz

 

运行后报错:

graphviz.backend.execute.ExecutableNotFound: failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH

 

 

报错的全部信息:

Traceback (most recent call last):
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/backend/execute.py", line 81, in run_check
    proc = subprocess.run(cmd, **kwargs)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: PosixPath('dot'): PosixPath('dot')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "cartpole.py", line 76, in <module>
    evaluation()
  File "cartpole.py", line 56, in evaluation
    visualize.draw_net(p.config, winner, True, node_names=node_names)
  File "/home/devil/Desktop/neat/visualize.py", line 150, in draw_net
    dot.render(filename, view=view)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/_tools.py", line 171, in wrapper
    return func(*args, **kwargs)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/rendering.py", line 122, in render
    rendered = self._render(*args, **kwargs)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/_tools.py", line 171, in wrapper
    return func(*args, **kwargs)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/backend/rendering.py", line 327, in render
    capture_output=True)
  File "/home/devil/anaconda3/envs/tmp2/lib/python3.7/site-packages/graphviz/backend/execute.py", line 84, in run_check
    raise ExecutableNotFound(cmd) from e
graphviz.backend.execute.ExecutableNotFound: failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH

 

=========================================

 

解决方法:

sudo apt install graphviz

 

 

PS:

原来是没安装绘图的程序,只安装了python的连接模块。

 

 

参考:

https://blog.csdn.net/iLOVEJohnny/article/details/128825005

 

 

 

==========================================

 

posted on   Angry_Panda  阅读(1772)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
历史上的今天:
2021-05-13 【转载】 比特币地址的原理和意义
2019-05-13 【转载】 180623 Conda install 本地压缩包文件tar.bz2
2018-05-13 機器學習基石 机器学习基石(Machine Learning Foundations) 作业2 第10题 解答
2018-05-13 (转) 从windows XP到10的微软官方操作系统虚拟机镜像,即下即用,不用安装

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示