vim could not load library python27.dll

Solution 1:

Diagnostics

:version will show you if you have 32bit vim or 64bit
python.exe will show you if you have 32bit or 64bit python.

Resolution

Now it's up to you to choose either:

  • 32bit vim + 32bit python or

  • 64bit vim + 64bit python

otherwise it won't work complaining with the error you quoted.

NB Latest 64bit vim cannot be downloaded from the download page anymore. For some mysterious reason now there's a new special page for that:

http://vim.wikia.com/wiki/Where_to_download_Vim

Solution 2:

Are you sure that you installed the same version of 32 bit python that Vim was looking for? I see no reason that this wouldn't have fixed your problem, unless you somehow had a gvim exe built without python support. Anyway, I had precisely this problem, and the obvious thing to me was that my python dll was x64, whilst I had 32 bit vim. The solution for me was simply to build a 64 bit version of Vim. I much prefer upgrading Vim to downgrading Python. The arguments I sent to the make file were:

nmake -f Make_mvc.mak GUI=yes CPU=AMD64 PYTHON=C:\Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27

I then replaced my original 32 bit gvim.exe with the 64 bit one I just built. Everything worked perfectly. If you are worried about the hassle of the build, don't be- it was very straightforward using visual studio 2010's compilers, and running make from the appropriate visual studio command prompt (x64 cross tools). I can send further instructions if needed.

Solution 3:

Ok here it goes: For some reason installing "cream" fixes it: cream.sourceforge.net.

:python print("hello")
hello

Interestingly enough, "cream" includes a regular version of "gvim" - so I can use just that.