When starting vim in a mingw64 terminal emulator on windows, the command :py print(1) fails, saying

Could not load library msys-python2.7.dll
Sorry, this command is disabled, the Python library could not be loaded.

My vim installation DOES have python support, as vim --version shows both python/dyn as python3/dyn. Also, when executing the same command in gvim, no problems.

(Needless to say, I have python installed, both 2 and 3)

What could be the cause of this problem?


The :help python-dynamic mentions the following:

To use the Python interface the Python DLL must be in your search path. In a console window type "path" to see what directories are used.

The name of the DLL must match the Python version Vim was compiled with. Currently the name is "python24.dll". That is for Python 2.4. To know for sure edit "gvim.exe" and search for "python\d*.dll\c".

Perhaps the python versions you installed doesn't matches the versions that Vim expects. It is also possible that there is a mismatch on the dll name.

  • Searching in gvim.exe yield matches of python27.dll and python32.dll. My python installations (which are also in the path) are 2.7 and 3.5. Weird things is, why does it search for msys-python2.7.dll and not python2.7.dll? – Chiel ten Brinke Dec 15 '15 at 11:03
  • You mentioned you are running vim from mingw64 on windows, which should explain the msys* reference (Msys in wikipedia). Try duplicating the executable to match the name on the error message. – mMontu Dec 15 '15 at 11:27

just a note as this happen to me. Official gvim on window is 32bits (even though it can be run on 64bits!), so the python installed has to be 32 bits as well. Otherwise same error pop up and you thought the path was set wrongly...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.