为什么'tensorflow.keras.utils.plot_model()'即使我安装了'pydot'和'graphviz'也失败了?

2024-10-02 06:28:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在遵循documentation,并试图用tensorflow.keras.utils.plot_model()绘制我的MLP的体系结构。然而,它不断地回归

('Failed to import pydot. You must `pip install pydot` and install graphviz (https://graphviz.gitlab.io/download/), ', 'for `pydotprint` to work.')

尽管我特别检查了pydotgraphviz已在安装的软件包中列出。为什么会这样?我该怎么做才能修好它


附言

pip install pydot
pip install pydotplus
pip install graphviz

pip list

我已经运行了上面的程序,并检查了3个包:pydotpydotplusgraphviz确实在已安装包的列表中。尽管如此,调用tensorflow.keras.utils.plot_model()返回相同的错误。我还尝试从https://graphviz.gitlab.io/download/下载一个.tar.gz文件并运行

PS C:\Users\pawindata\Downloads> pip install graphviz-2.44.1.tar.gz

PS D:\Python\Scripts> pip install C:\Users\pawindata\graphviz.-2.44.1.tar.gz

它只返回一些我不知道如何正确阅读的内容

    ERROR: Command errored out with exit status 1:
     command: 'd:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'"'"'; __file__='"'"'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\pawindata\AppData\Local\Temp\pip-pip-egg-info-w1om_ysn'
         cwd: C:\Users\pawindata\AppData\Local\Temp\pip-req-build-mumd1dhq\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:\python\lib\tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\pawindata\\AppData\\Local\\Temp\\pip-req-build-mumd1dhq\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Tags: installpippybuildlocalsetuprequsers

热门问题