Vim with both python/dyn and python3/dyn uses python 2 by default

3.6k Views Asked by At

As you already know I have vim problems. I usually use python 3 with pymode enabled. Today I wanted to add a nice autocompletion for python to my vim and the things became messy. I wanted to install [YouCompleteMe][1] with pathogen, and I saw that requires vim to be installed with python2 support.But pymode needs python3 support (or at least I need it with python3 support) After a lot of googling I precompiled and installed both python versions with --enable-shared configuration and vim with both supports(python/dyn and python3/dyn)

The problem is that vim doesn't load python3 when needed.

I'm working on a project in python 3 and I tried adding this to the end of file:

import site
print(site.getsitepackages())

The output is:

['/usr/lib/python2.7/site-packages', '/usr/lib/site-python']

And if i type this as vim's command :

:py3 import site; print(site.getsitepackages())

The output is:

['/usr/lib/python3.4/site-packages', '/usr/lib/site-python']

I still haven't try to install YouCompleteMe...

My question is: how can I tell vim to use python3 by default instead of python2 ? (without recomiling it with only python3 support)

1

There are 1 best solutions below

0
DOOM On

Vim and its plugins are not pre-compiled objects files but are rather callable scripts which often simplify by not specifying version to be used.

If

$ python
  Python 2.7.3 (default, Feb 27 2014, 19:58:35)

then vim is using python 2.7. Changing default python is not a good idea. As i mentioned in my comment .. u should look at temporary option. One of the simplest option (bash-shell):

$ alias python='python3.2'
$ python
  Python 3.2.3 (default, Feb 21 2014, 00:48:19) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.