I just followed these instructions to compile vim with python 3: https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

After the install I checked to see if I have python3:

vim --version | grep "python"

Which returned:




But when I start vim and type one of the followinf commands, I get a 0:

  • :echo has('python3/dyn')
  • :echo has('python3')
  • :echo has('python')
  • :echo has('python/dyn')

Has anyone had a similar problem?

EDIT: Hey guys lots of helpful comments, I just wanted to say thanks and let you guys know what I did to solve this. I followed the instruction again from the first link I provided but this time I removed vim.tiny and instead of trying to get vim to support both python2 and python3, I just build with python3 support. This fixed it


python3 print("works")

in vim, shows works. Typing

echo has('python3')

gives me an output of 1 and finally

vim --version | grep python3

Gives me a value of +python3

Thanks guys for all the help and suggestions!!

  • Try running an actual Python command, e.g. :python print "works"; that's the best test (at least interactively; in a script I would prefer has('python'),which should work. – Ingo Karkat Sep 20 '16 at 16:09
  • If you're on Ubuntu, use pi-rho's PPA (launchpad.net/~pi-rho/+archive/ubuntu/dev). It has vim built with dynamic Python/Python3 support. – muru Sep 20 '16 at 18:11
  • It worked for me too! – Enlico Jun 8 '17 at 20:44
  • I had same problem and solved it by configuring the Vim just using with Python3 but without Python. – adembudak May 25 '20 at 1:36

This is the expected result. There are no tests has('python/dyn') and has('python3/dyn'), only has('python') and has('python3').

  • 6
    still does not help if I do has('python3') or has('python'), i still get a 0 – user1314272 Sep 20 '16 at 10:19
  • The point is that you can't test for dynamic python with has() so… don't use has(). – romainl Sep 20 '16 at 11:55
  • 2
    @romainl Then why it is a documented feature that can be checked for with has() under :help feature-list? – jamessan Sep 20 '16 at 16:15
  • has('python') returns 1 for +python and +python/dyn. Same thing for has('python3') and +python3/+python3/dyn. Also, has('python/dyn') and has('python3/dyn') always return 0, whether the feature is there or not. Conclusion: either you can't use has() to determine if you have +python[3]/dyn or neither Sato Katsura nor me know how to format the argument properly. – romainl Sep 20 '16 at 16:25
  • 1
    Although, it would be useful for Vim to support the /dyn checks, especially since has('python') loads the Python library, which means you then can't use python3, and vice-versa. – jamessan Sep 20 '16 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.