Today I took a day off from work so as always when I try some new stuff I end up spending 2 hours on my Vim configuration before actually getting something done. So todays two hours where spent on getting Vim compiled with python3 support.
First off - do use Vim8 - it's awesome and do compile it from source. It's rather simple and saves you from outdated packages on Ubuntu :).
Now my issue today was that I tried enabling python2 and python3 support at the same time. For no apparent reason the following configuration did always result in a vim binary that thought it had python support - but didn't.
./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-pythoninterp=yes \ --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \ --enable-python3interp=yes \ --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-cscope --prefix=/usr \ --enable-fail-if-missing
Running vim --version
resulted in +python/dyn
and +python3/dyn
so I thought - cool it's working.. Until I started vim and was greeted by:
Sorry, this command is disabled, the Python library could not be loaded.
To make things more interesting :echo has('python')
did return 0 too - although the Vim was built with python support (and --enable-fail-if-missing
is supposed to fail if python can't be linked).
So after trying around a bit and not getting anywhere I decided to just remove the python3 support from the configure
line and voila - python is statically linked and working.. Yay!
./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-pythoninterp=yes \ --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-cscope --prefix=/usr \ --enable-fail-if-missing