Although Ubuntu 16.04 release notes mention that:
The default VIM package has been built against python3 instead of python2.
Yet after I installed vim with the following command:
sudo apt-get install vim
And checked:
vim --version
It showed:
-python
-python3
Is it a bug? How do I get vim with Python support?
If you want Python 3 support in vim,
install thesee edit below.vim-nox
package (sudo apt install vim-nox
)However, if you still need Python 2 support, install the
vim-nox-py2
package (sudo apt install vim-nox-py2
).Edit:
vim
was recently updated to fix this issue, and you should not need to install thevim-nox
package anymore to get Python 3 support.In 17.10-18.10 it is difficult to get a copy of vim with both python2 and python3 support. The PPA setup by pi-rho has such packages for previous releases, but nothing yet for 17.10 and later.
This is what I did to get pi-rho packages running:
sudo dpkg -i libgdbm3_1.8.3-14_amd64.deb libperl5.24_5.24.1-2ubuntu1.1_amd64.deb perl-modules-5.24_5.24.1-2ubuntu1.1_all.deb vim*.deb
sudo apt install ubuntu-minimal
sudo apt-mark hold
for each of those packages (e.g.sudo apt-mark hold vim-common vim-gnome
)Try installing vim-gnome instead of vim.
If that can help, you can install the package python-support by downloading the latest version of python-support_X.X.X_all.deb there : https://launchpad.net/ubuntu/+source/python-support Open a terminal in same folder and install with:
See if it helps
On Ubuntu 17.10, compiling is the solution that worked for me:
Directly inspired by this gist, I did the following:
Don't forget to adapt the
./configure
parameters so you have all the other features you need.Now you can open vim and run the command
:echo has('python')
to confirm you have python 2 enabled.Installing
vim-nox-py2
and then runningworked for me.