How to Get Python2 and Python3 support for Vim on Debian

By Max

Python 3 Completion with Vim and YouCompleteMe

While working on my final project for PDX Code Guild I decided to try YouCompleteMe to help me write my final project with Django & Python3. I noticed that YouCompleteMe was working only for Python 2, and wouldn’t complete for the site packages. After reviewing several tickets on GitHub I discovered Python 3 and Vim support would be needed. However, currently Vim installed via apt on Debian based systems only supports Python 2. There’s a Debian ticket to fix this with little resolution at the moment. I’m not sure how to fix it at this moment. However I wasn’t willing to accept that as the final answer.

After searching, it turns out Vim isn’t hard to compile from scratch. I found several sites where discussions were about removing the system package and compiling your own. Which seems to be hackish, and I’m not a fan of that.

No one suggested just naming the binary executable to a different name...which is what I’ll do. Then I’ll either alias my system package or I’ll simply run vim3 when I need python 3 support.

install debian packages

sudo apt-get install libgtk2.0-dev xorg-dev checkinstall
#  assumes you have vim dep installed, if you use gnome, install gnome headers

configure vim

You’ll need to clone vim from GitHub and make your working directory the root of the git repo. Checkout the tag that matches your systems version.

vim# ./configure --with-features=huge \     
            --with-x \
            --enable-xim \
            --enable-gui=gtk2 \ # note if you’ll need to use the 
            --enable-gtk2-check \ # correct gui lib
            --enable-multibyte \
            --enable-rubyinterp \
            --enable-pythoninterp \ 
            --enable-python3interp \
            --enable-perlinterp \
            --enable-luainterp \
            --enable-cscope \
            --prefix=/usr/local \
            --with-vim-name=vim3 # name it what ever you’d like to use
vim# make VIMRUNTIMEDIR=/usr/share/vim/vim74

build deb && install

vim# sudo checkinstall

# Bunch ‘o stuff happens then you’ll get.
 Done. The new package has been installed and saved to


 You can remove it from your system anytime using: 

      dpkg -r vim3


If you install, but then recompile, I suggest you use dpkg -r vim3 before re-installing.