I've tried setting meld as my mergetool to use with git doing:
git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/meld
As outlined in answers to questions like:
How to set Meld as git mergetool
I used to have this working on my old work machine but now on my new machine where I have Python3 installed instead of 2.7 I am getting the following error whenever I try git mergetool:
C:/Program Files/Git/mingw64/libexec/git-core/mergetools/meld: c:/Progra~2/Meld/bin/meld: C:/msys64/MINGW32/bin/python3.exe: bad interpreter: No such file or directory
Any ideas what extra steps I need to make to get this to work with Python3?
EDIT: I have tried pointing directly to Meld.exe too but that causes the following crash:
The .../bin/meld
script is mostly there for reference. You should set
git config mergetool.meld.path "C:/Program Files (x86)/Meld/Meld.exe"
You don't need to use Progra~2
notation unless you really want to for some reason.
The only issue that I am having is that it is not properly picking up the installed dependency extensions in C:/Program Files (x86)/Meld/lib
. You need to add C:/Program Files (x86)/Meld/lib
to your PATH
environment variable, either with SET PATH=C:/Program Files (x86)/Meld/lib;%PATH%
, or through the "Edit Environment Variables for your account" somewhere in control panel/start menu.
Alternative Approach
If you open C:\Program Files (x86)\Meld\bin\meld
in a text editor, you will see that it is a shell script that is intended to be run in python3
(called from C:\Program Files\Git\bin\sh.exe
most likely).
The first line of meld
reads:
#!C:/msys64/MINGW32/bin/python3.exe
This issue does not pop up when using Meld.exe
because it does not use the script through a python interpreter.
It is unlikely that the python interpreter is installed at that location on your machine. Instead, you can replace the shebang line to point to an existing interpreter. For example, on my machine, meld
starts with:
#!C:/Users/MadPhysicist/AppData/Local/Continuum/anaconda3/python.exe
This still won't be enough for the script to find the meld
package and all the installed GTK, cairo, etc. DLLs, so you have to tweak both the python and system paths. Insert the following before the line import meld # noqua: E402
(line ~78):
os.environ['PATH'] = os.pathsep.join((melddir, os.path.join(melddir, 'lib'), os.environ['PATH']))
sys.path[0:0] = [os.path.join(melddir, 'lib/python3.7/site-packages')]
I was not ever able to get the first line to set up Cairo, GTK, etc. correctly for meld
. You can, however, skip the first line and just install the packages using conda or pip. You will still need to insert the meld package into sys.path
.
Keep in mind that meld
is compiled in 32 bits, as evidenced by the x86
in the install folder. You can only run it with a 32-bit python interpreter if you use the included DLLs, which may require additional installation. You do not need a 32-bit interpreter if your environment contains all the necessary packages already.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With