compiling vim with python support

Yea! I figured it out, so I'm writing up a quick how-to in case others run into the same issue:

  1. I didn't notice an important message in the configure output:

    checking if compile and link flags for Python are sane... no: PYTHON DISABLED 
    
  2. The log file had more info located in src/auto/config.log:

    /usr/bin/ld: skipping incompatible <mypydist>/2.5/lib/python2.5/config//libpython2.5.a when searching for -lpython2.5
    /usr/bin/ld: cannot find -lpython2.5
    
  3. I found an old thread that said you can override the gcc call by setting:

    export vi_cv_path_python_plibs="-L/<mypydist>/2.5/lib/python2.5/config/ ..."
    excluding the -lpython2.5
    

Now it compiles.


I've also had "... and link flags for Python are sane... no: PYTHON DISABLED"

On Ubuntu 10.04 you have to install 'python2.6-dev'. The flags for ./configure are:

--enable-pythoninterp

--with-python-config-dir=/usr/lib/python2.6/config

Make sure you got a path to directory, which contains 'config.c' file. Also no '/' at the end of the path! That caused me problems.


You could try adding the option --with-python-config-dir=/your/python/config/dir

The path should point to the location of the file config.c of your Python installation.


I ran into a similar problem with Python2.7 and openSUSE 11.4/64. Here's a technique that worked for me:

zypper ar http://download.opensuse.org/repositories/editors/openSUSE_11.4 editors
zypper in vim-enhanced
zypper in vim-enhanced-7.3-112.1.x86_64

vim-enhanced on openSUSE is compiled with +python. vim-enhanced from the standard openSUSE repo crashed when trying :python print 'hello' in vim. The compiled version from the editors repo worked for me without crashing.

Tags:

Python

Vim