Windows 10 中的 MikTeX、Anki 和 Latex。执行 dvipng 时出错。抱歉,dvipng 未成功

Windows 10 中的 MikTeX、Anki 和 Latex。执行 dvipng 时出错。抱歉,dvipng 未成功

我在 Windows 10 中安装了 Anki 和 MikTeX,以便使用 LaTeX 创建 anki 抽认卡。我安装了 MikTeX,因为我读到它是安装 dvipng 和 dvisvgm 的最佳方式。

创建抽认卡示例后,程序尝试编译它时出现以下错误。我不知道如何解决它。有什么建议吗?

Error executing dvipng.
Generated file: C:\Users\Victor\AppData\Local\Temp\anki_temp\tmp.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930 64-bit)
entering extended mode
(tmp.tex
LaTeX2e <2018-12-01>
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size12.clo"))
("C:\Program Files\MiKTeX 2.9\tex/latex/base\inputenc.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\amssymb.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\amsfonts.sty"))
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsmath.sty"
For additional information on amsmath, use the `?' option.
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amstext.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsgen.sty"))
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsbsy.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsopn.sty"))
No file tmp.aux.
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\umsa.fd")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\umsb.fd") [1] (tmp.aux) )
Output written on tmp.dvi (1 page, 268 bytes).
Transcript written on tmp.log.
This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson

Sorry, but dvipng did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:\Users\Victor\AppData\Local\MiKTeX\2.9\miktex\log\dvipng.log

以下是dvipng.log的内容:

2019-02-24 12:47:26,503+0100 INFO  dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:47:26,517+0100 INFO  dvipng - running 'initexmf' to refresh the file name database
2019-02-24 12:47:29,551+0100 INFO  dvipng - running 'initexmf' to create font map files
2019-02-24 12:47:31,582+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:47:31,583+0100 FATAL dvipng - Info: 
2019-02-24 12:47:31,583+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:47:31,583+0100 FATAL dvipng - Line: 77
2019-02-24 12:47:31,584+0100 INFO  dvipng - finishing with exit code 1
2019-02-24 12:47:37,285+0100 INFO  dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:47:37,301+0100 INFO  dvipng - running 'initexmf' to refresh the file name database
2019-02-24 12:47:40,429+0100 INFO  dvipng - running 'initexmf' to create font map files
2019-02-24 12:47:42,378+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:47:42,378+0100 FATAL dvipng - Info: 
2019-02-24 12:47:42,378+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:47:42,378+0100 FATAL dvipng - Line: 77
2019-02-24 12:47:42,379+0100 INFO  dvipng - finishing with exit code 1
2019-02-24 12:51:12,899+0100 INFO  dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:51:13,009+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:51:13,009+0100 FATAL dvipng - Info: 
2019-02-24 12:51:13,009+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:51:13,009+0100 FATAL dvipng - Line: 77
2019-02-24 12:51:13,010+0100 INFO  dvipng - finishing with exit code 1
2019-02-24 12:51:13,575+0100 INFO  dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:51:13,597+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:51:13,597+0100 FATAL dvipng - Info: 
2019-02-24 12:51:13,597+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:51:13,597+0100 FATAL dvipng - Line: 77
2019-02-24 12:51:13,598+0100 INFO  dvipng - finishing with exit code 1

答案1

我遇到了完全相同的问题,请尝试打开MikTeX console>Settings并确保已检查Never install missing packages on the fly。对我有用。

答案2

dvipng -D 200 -T tight tmp.dvi -o tmp.png在包含 的目录中的命令提示符中运行dvi.png,该目录与生成的 存储在同一个目录中tmp.tex。Anki 中的错误消息会告诉您那是哪里。在您的情况下是C:\Users\Victor\AppData\Local\Temp\anki_temp\。这是 Anki 执行的相同命令,但失败了,如 中所示dvipng.log。对我来说,弹出一个窗口说我缺少库并需要安装它们。安装后,下次运行命令时窗口就不会弹出。这意味着当 Anki 尝试执行时dvipng不会失败,因为dvipng不会尝试打开一个窗口告诉 Anki 安装库。

相关内容