I'm using Vim on Fedora 28 and Python seems to be enabled:

vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 11 2018 10:00:51)
Included patches: 1-177
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl/dyn          +vartabs
-clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           +python/dyn        +viminfo
+conceal           +linebreak         +python3/dyn       +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua/dyn           +ruby/dyn          +writebackup
+dialog_con        +menu              +scrollbind        -X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       -xim
-dnd               +mouse             +startuptime       -xpm
-ebcdic            -mouseshape        +statusline        -xsmp
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_clipboard
+eval              +mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    

Hovewer, when I open Vim and issue :echo has('python') it returns 0

Both Python 2.x and 3.x version are installed on Fedora by default.

Any suggestion?

  • 2
    What does has ('python3') says ? (I ask because has ('python') and has ('python3') cannot be true simultaneously) Jul 16, 2018 at 16:46
  • Hi, Luc. Thanks for your answer. has ('python3') returns 1. Jul 16, 2018 at 17:52

2 Answers 2


Have a look at :help python3 and the subsequent sections on python-2-and-3 and pythonx. If python is compiled with +python/dyn, +python3/dyn, then it effectively has support for Python 2 and 3.

Checking available version.

You can test what Python version is available with:

   if has('python')
    echo 'there is Python 2.x'
   if has('python3')
     echo 'there is Python 3.x'

Checking the version which was compiled with Vim without loading Python

Note however, that when Python 2 and 3 are both available and loaded dynamically, these has() calls will try to load them. If only one can be loaded at a time, just checking if Python 2 or 3 are available will prevent the other one from being available.

To avoid loading the dynamic library, only check if Vim was compiled with python support:

 if has('python_compiled')
   echo 'compiled with Python 2.x support'
   if has('python_dynamic')
     echo 'Python 2.x dynamically loaded'
 if has('python3_compiled')
   echo 'compiled with Python 3.x support'
   if has('python3_dynamic')
     echo 'Python 3.x dynamically loaded'

Using pyx

Using pyx in the place of python2 or python3 will automatically select the version set by pyxversion. This also provides another way to check the version.

To see what version of Python is being used:

 :pyx import sys
 :pyx print(sys.version)

because of vim installed as 32-bit, but python installation using x64. uninstall the python x64 and re-install python ( default is 32bit ) will fix the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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