I need Windows 7 + vim + python for writing vim plugins.

:python print("hello")
E370: Could not load library python27.dll
E263: Sorry, this command is disabled, the Python library could not be loaded.

Tried everything:

  • reinstalled vim
  • uninstalled all my 64bit python versions and installed 32bit ones
  • reinstalled vim again
  • restarted computer
  • punched desk and keyboard
  • restarted computer
link|improve this question

43% accept rate
For all those having the same problem: installing "cream" fixes it: cream.sourceforge.net Yes - this question will probably get closed - but the fact is that there is still no solution to this anywhere on the web. – drozzy Aug 11 '11 at 21:00
Answering your own question is good, but post it as an answer, not a comment, then accept it after two days. – agf Aug 11 '11 at 21:03
compile it with python support – Eric Fortis Aug 11 '11 at 21:52
Hm... I am not compiling it, but rather downloading an installer. – drozzy Aug 11 '11 at 22:52
feedback

migrated from stackoverflow.com Aug 12 '11 at 1:40

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 2 down vote accepted

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.

link|improve this answer
feedback

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.

link|improve this answer
i was exactly in your situation. since i didn't want to recompile vim, i installed the 32bit version of python 2.7 and now gvim works like a charm! – avastreg Apr 2 at 23:05
feedback

Your Answer

 
or
required, but never shown

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