I have Ubuntu 14.04 installed and Vim in its repos is compiled without Python 3 support. Because of that, python-mode plugin can't work with Python 3 code. What's the easiest way to get Vim with Python 3 support?
It seems on Debian-based systems (at least) you can't have your cake and eat it too. It's either Python 2 or Python 3. Due to how the Python libraries are built, you can only use one variant within a Vim session. You can build with both, but if Python 2 is called in Vim, then Python 3 cannot be called in the same session, and vice versa. On Arch Linux as well, Vim is only compiled with one of Python 2 (
gvim) or Python 3 (
To rebuild the Vim that the repositories provide:
sudo apt-get build-dep vim apt-get source vim cd vim-* # it will be vim-7.4.something
debian/rules and replace:
ALLINTERPFLAGS+=--enable-pythoninterp --with-python-config-dir=$(shell python-config --configdir) ALLINTERPFLAGS+=--disable-python3interp
ALLINTERPFLAGS+=--enable-pythoninterp=dynamic --with-python-config-dir=$(shell python-config --configdir) ALLINTERPFLAGS+=--enable-python3interp=dynamic --with-python3-config-dir=$(shell python3-config --configdir)
dpkg-buildpackage -us -uc
Have lunch. (Or tea if you used
.deb files will have been created in the parent directory. To see which:
cd .. ls vim*.deb
Along with the particular variant you want to install (
vim-gtk, etc.), you'll have to install
vim-runtime_*.deb, and for the GUI versions,
vim-gui-common_*.deb. For example, with
vim-gnome, and the current version of
vim in the repositories:
sudo dpkg -i vim-gnome_7.4.052-1ubuntu3_amd64.deb vim-common_7.4.052-1ubuntu3_amd64.deb vim-gui-common_7.4.052-1ubuntu3_all.deb vim-runtime_7.4.052-1ubuntu3_all.deb
$ vim --version | grep python +cryptv +linebreak +python/dyn +viminfo +cscope +lispindent +python3/dyn +vreplace
The pi-rho/dev PPA builds Vim in this fashion, so you can use the PPA instead of manually building it.
As of 16.04, Ubuntu builds Vim with Python 3 support. Python 2 support is provided by the
-py2 packages (
protected by Community♦ Aug 29 '15 at 17:50
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?