Error: Required vim compiled with +python
E117: Unknown function: pythoncomplete#Complete
This is incorrect. After doing a :version
command, Vim showed it was compiled for Python support (the +python/dyn
option was present). The real problem was Vim could not find the correct version of Python it was expecting: I had 2.6 installed, Vim wanted 2.4 (DYNAMIC_PYTHON_DLL="python24.dll"
).Following is one way to compile Vim to use a different version of Python than that shipped with Vim. I targeted 2.6, but the steps can be tweaked to work for any version of Python. It is assumed Vim and Python are already installed.
- Obtain a C++ compiler. I considered two, GCC from Cygwin and GCC from MinGW. I went with the latter simply because it was easy to install only the C/C++ development tools (e.g. GCC, make) that I needed. The Cygwin installer had far too many packages to chose from. I didn't want to waste my time determining what was necessary to install from packages I had no interest in.
- Obtain Vim source code and unzip somewhere, say
C:\
. - Edit the MinGW make file. For me that is
C:\vim\vim72\src\Make_ming.mak
. Find the variablePYTHON_VER
and set the version number to whatever version of Python you have installed. Also, find the variablePYTHON
and set to the root of the Python installation directory. In my case,
PYTHON=c:/Programs/Python26 PYTHON_VER=26
- MinGW did not add the location of the GNU make tool to my
PATH
, so I had to manually do that next. Since I had no intentions of using this tool after I was done compiling Vim, I updated my path temporarily. To do that, I opened a command prompt in the directory of the make file (C:\vim\vim72\src
) and executed
whereset PATH=%PATH%;C:\Programs\MinGW\bin
C:\Programs\MinGW
is the location where I installed MinGW. - Compile GVim. Using the same command prompt window in which
PATH
was changed, execute
Normally you would executemingw32-make -f Make_ming.mak gvim.exe
make -f Make_ming.mak gvim.exe
, butmake.exe
seems to have been renamed tomingw32-make.exe
in the MinGW installation. - Install gvim.exe. After compiling is done, locate
gvim.exe
in the same directory as the make file (C:\vim\vim72\src
) and copy to Vim's runtime directory. For my,C:\Program Files\Vim\vim72
. There should already be agvim.exe
there. - Make sure the Python 2.6 installation is on your path, namely the directory where Python26.dll is located.