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 2023-05-13 12:10 Angry_Panda 阅读(1772) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需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的微软官方操作系统虚拟机镜像,即下即用,不用安装