GIT bash on Windows: VIM doesn't find Python3

1.8k Views Asked by At

Good Morning, my VIM isn't able to find my Python installation on windows. Thanks in advance for all who take the time to read this question :)

My Current Setup I'm currently running VIM 8.0.27 inside GIT Bash on windows (unmodified 64bit setup from https://git-scm.com/download/win). Furthermore i've installed the 64bit version of Python 3.5.2 in the following directory: "C:/Python35/" I've added "C:/Python35/" and "C:/Python35/Scripts/" to my PATH variable. VIM seems to be compiled with Python support as the version text includes "+python/dyn" and "+python3/dyn".

My Problem

It appears to me that VIM is not able to find my python installation. When I call ":echo has('python')" or ":echo has('python3')" it returns 0. I get the following error message when I try to start VIM with python plugins installed: "UltiSnips requires py >= 2.7 or py3".

Long Term Goal

My goal is to get Greg Hurrel's VIM configuration up and running on Windows 7 (https://github.com/wincent/wincent). Among other things it requires Python and Ruby. I would also appreciate hints regarding other (better) ways to achieve this.

Details

$ which python35.dll

/c/Python35/python3.dll

in vim: ":echo $PATH"

/c/Users/JannikV/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/JannikV/bin:/c/Python35/Scripts:/c/Python35:/c/Program Files/Intel/iCLS Client:/c/Windows/system32: ...

$ vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 12 2016 13:28:14)
Included patches: 1-27
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby/dyn        -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2 - I/usr/include/ncursesw  -march=x86-64 -mtune=generic -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -pipe -fstack-protector -pipe -Wl,--as-needed -o vim.exe        -lm    -lncursesw -liconv -lacl -lintl   -pipe -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -ldl -lcrypt`
2

There are 2 best solutions below

0
On

The bitness of your vim build must match the bitness of your Python version. AFAIK, the bitness of the vim that comes with Git for Windows is 32-bit, so it won't talk to 64-bit Python.

Check if running 32-bit Windows version of terminal vim from Git Bash:

:echo has('win32unix')
0
On

After much effort I finally got python to work with gvim 8.0 on windows 10. The secret is that it has to be python version 2.7.0 (higher versions may work, 2.7.13 does not).

I also have python 3.6 installed to use when I actually do python programming.

python 2.7.0 is not in my PATH environment variable, but I suspect that doesn't matter.