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_VERand set the version number to whatever version of Python you have installed. Also, find the variablePYTHONand 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\binC:\Programs\MinGWis the location where I installed MinGW. - Compile GVim. Using the same command prompt window in which
PATHwas changed, execute
Normally you would executemingw32-make -f Make_ming.mak gvim.exemake -f Make_ming.mak gvim.exe, butmake.exeseems to have been renamed tomingw32-make.exein the MinGW installation. - Install gvim.exe. After compiling is done, locate
gvim.exein 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.exethere. - Make sure the Python 2.6 installation is on your path, namely the directory where Python26.dll is located.