我正在尝试在 Windows 上使用 Meld 作为 Git Difftool 并面临以下问题:

Launch 'meld' [Y/n]? Y
Cannot import: GTK+
DLL load failed: Das angegebene Modul wurde nicht gefunden.

出现以下 Python 错误:
cx_Freeze: Python error in main script

Traceback (most recent call last):
  File "bin/meld", line 205, in check_requirements
    import gi
  File "C:/msys64/MINGW32/lib/python3.7/site-packages/gi/__init__.py", line 42, in <module>
  File "ExtensionLoader_gi__gi.py", line 23, in <module>
  File "ExtensionLoader_gi__gi.py", line 15, in __bootstrap__
  File "C:/msys64/MINGW32/lib/python3.7/imp.py", line 342, in load_dynamic
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/msys64/MINGW32/lib/python3.7/site-packages\cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "C:/msys64/MINGW32/lib/python3.7/site-packages\cx_Freeze/initscripts/Console.py", line 26, in run
  File "bin/meld", line 362, in <module>
    check_requirements()
  File "bin/meld", line 211, in check_requirements
    missing_reqs("GTK+", gtk_requirement, e)
  File "bin/meld", line 194, in missing_reqs
    show_error_and_exit(_("Cannot import: ") + mod + "\n" + str(exc))
  File "bin/meld", line 182, in show_error_and_exit
    raise Exception(error_text)
Exception: Cannot import: GTK+
DLL load failed: The specified module could not be found.

当我尝试在 git bash 中运行 meld.exe 时出现同样的问题。

要将 meld 用作 difftool,我更改了用户 gitconfig 文件中的设置:
[merge]
    tool = meld
[mergetool "meld"]
    path = C:\\Program Files (x86)\\Meld\\meld.exe
[diff]
    tool = meld

这似乎是正确的,因为 git 在工作区中使用命令 'git difftool' 后试图启动 meld.exe。

最佳答案

遵循 lib-workaround 有助于能够将 meld.exe 作为外部 git difftool 启动:

Meld 期望某个名为“libgirepository-1.0-1.dll”的 dll 文件位于错误的目录中,需要将文件 libgirepository-1.0-1.dll 从 C:\Program Files (x86)\Meld\lib 复制到C:\Program Files (x86)\Meld 上面的目录。

结果是Meld在'git difftool'命令后启动,在git bash中运行meld.exe后,出现如下错误:

2019-09-18 14:12:24,612 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.612: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,612 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.612: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,613 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.613: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,614 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.614: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,614 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.614: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,615 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.615: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,615 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.615: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,616 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.616: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,617 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.617: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:24,617 CRITICAL Gtk:
(meld.exe:20432): GLib-GIO-CRITICAL **: 14:12:24.617: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,202 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.201: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,203 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.203: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,204 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.204: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,204 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.204: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,205 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.205: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,206 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.206: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,207 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.207: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,499 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.499: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,500 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.500: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,501 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.501: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,538 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.538: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,540 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.540: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,540 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.540: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,542 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.541: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,542 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.542: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,543 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.543: g_content_type_is_a: assertion 'type != NULL' failed
2019-09-18 14:12:26,544 CRITICAL Gtk:
(org.gnome.meld:20432): GLib-GIO-CRITICAL **: 14:12:26.544: g_content_type_is_a: assertion 'type != NULL' failed

关于git - 将 meld.exe 作为外部 git difftool 启动时出现 Meld 错误 “Cannot import: GTK+; DLL load failed",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57990245/

10-12 19:16