1

Problem description:

For all the executable installers for Vim that are listed below, the tags +python/dyn and +python3/dyn are unanimous when installed. However, for all my local installations using these installers, none worked. I don't have enough reputation to include more than two URLs. So, reference to the installers goes to the comment.

  1. The plain Vim version from Vim Cream.
  2. The "official", yet obsolete Vim installer.
  3. "Home built" Vim distributions released by kindhearted individuals.

What has caused the problem

There is a single line of command in my _vimrc:

  let $PYTHONHOME = 'C:/Program Files/Anacoda'

While, as I played with those Vim distributions + Python packages, I did not pay attention to this :( Now, deleting this funky line cures all my problems. Nevertheless, it is good to know there are numerous ways to properly install Vim onto Windows machine.

The specific error

When I try the command python import sys, it gives me the error message "E887: Sorry, this command is disabled, the Python's site module could not be loaded." This error message would also occur when I try to invoke VOom and Vim-Latex-Suite, two Vim-plugins.

My installation attempts:

I adhere to the following two guidelines/restrictions:

  • Restriction 1: The version of Python

    According to the following discussions, it is clear that Vim may only work with Python 2.7.9 on Windows. Also, we shall match the 32-bit Vim with a 32-bit Python.

  • Restriction 2: The order of installation

    The gvim.exe shall need to see the python27.dll and the python33.dll. (This is accessible through :version in Vim.) So, one needs to install the Python distributions first, and then install the Vim executables. Yet, it is unclear to me if two versions of Python may exist on one Windows machine in harmony. So, I have never had the python33.dll available on my machine. Yet, gvim.exe may only complain about python27.dll should it have been missing. So far, I have never installed a Python 3.3 and I have never seen the Gvim complaining about the missing python33.dll. This also confused me.

Nevertheless, I still cannot get Vim to work with "a proper Python distribution".

Help needed!

Inexperienced with program developing, I am really having a hard time debugging this issue. Any advice would help!

As of now, I am trying to set up a complete installation of Cygwin, in hope that it may build a local Vim distribution; also, I am also attempting to pursue another route: to compile the source file of Vim using Visual Studio. Simply completely installing these two softwares takes hours.

Hope someone may help!

All the best,

-Linfeng

  • In completion of the Downloading links: 1. The plain Vim version from Vim Cream, accessible from: sourceforge.net/projects/cream/files/Vim 2. The "official", yet obsolete Vim installer, from: vim.sourceforge.net/download.php#pc 3. "Home built" Vim distributions released by kindhearted individuals: * tuxproject.de/projects/vim * solar-blogg.blogspot.com/p/vim-build.html – llinfeng Jul 5 '16 at 19:10
  • Installing a complete Cygwin is not recommended. There are ~ 4000 packages mostly irrelevant to your need. Cygwin has vim, gvim and python, but I have not understood what are you really looking for. – matzeri Jul 5 '16 at 21:23
  • To clarify: I would like to have a gvim.exe with Python enabled. As described, I failed to achieve so. Basically, I can find all the check marks for +python/dyn and +python3/dyn through command :version, yet get the error message for :python being disabled. – llinfeng Jul 6 '16 at 2:46
  • @matzeri: thanks for pointing out the redundant packages for Cygwin. I plan to use it to build a python-enabled gvim.exe. Though, I have no idea if this may work. Days have been spent on this issue already, after I "upgraded" from Windows 8.1 to Windows 10. – llinfeng Jul 6 '16 at 2:48
  • Install a vim binary from here and don't forget to install the required python interpreter as well. – Christian Brabandt Jul 7 '16 at 7:38
0

Longer explanation

Long story spoken in the long way: what has been missing is not the "Python support" part (+python/dyn and +python3/dyn). Nearly all GVim installers available to the Windows users have built-in Python support. What has been really missing, is that Python don't know how to call the Python program. Thus, all you need to do is to guide a Python-enabled GVim to find python.exe.

Short solution

Add the following line to the _vimrc:

  • let $PYTHONHOME = 'C:/Users/UserName/AppData/Local/Continuum/Anaconda2/'

Generalized solution

In short, you need to first find any folder that contains python.exe. Then, please specify the $PYTHONHOME path correctly to such folder.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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