How to install Vim8 and enable Python3 Support On centos

Make sure you have following libraries installed

yum install checkinstall mercurial python-dev python3-dev ruby ruby-dev libx11-dev libxt-dev libgtk2.0-dev libncurses5 ncurses-dev

Now clone the vim git repo

git clone https://github.com/vim/vim
cd vim

Replace following with /usr/lib/python3.4/config-3.4m-x86_64-linux-gnu with Python version you have

./configure  \
    --enable-cscope  \
    --enable-gnome-check  \
    --enable-gtk2-check  \
    --enable-gui=auto  \
    --enable-multibyte  \
    --enable-perlinterp  \
    --enable-python3interp  \
    --enable-rubyinterp  \
    --with-compiledby="Senor QA <[email protected]>"  \
    --with-features=huge  \
    --with-x  \
    --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu  \
    --enable-fail-if-missing


make & make install


You might run in to following errors...

checking for ruby... no
configure: error: could not configure Ruby

Then install ruby first using following tutorial - install ruby on centos

To fix following error

configure error: X is not found

install following...

sudo yum -y xorg-x11-server-devel libX11-devel libXt-devel vim-X11 xorg-x11-apps xorg-x11-xauth xorg-x11-server-common python3-devel

Now open the vim and make sure Vim is compiled with Python3 binaries by running following command inside vim

:pythonx import sys; print(sys.version)

You should see something like this...

3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0]

That means python3 is enabled