Vim for Windows: Python not loading properly / "crashes"

I struggled for 2 days to install some plugins that use python on Vim (Windows). Even with vimrc stock.

Using official vim 7.4 binary (x86)

  • I checked that it comes with + python / dyn and + python3 / dyn
  • I installed Python 2.7.10 x86 and the added python path in the Path environment.
  • :echo has('python') prints 1 as expected.
  • However: when I type :python print 'test' , vim exits as if I type :q
  • :python mum tell me, why does windows exists? He leaves too. I wonder why ... Not a print problem at least.

Using tuxproject nightly builds vim 7.4.826 (x86)

  • It comes with + python / dyn and + python3 / dyn. Also:

Used libraries: Perl 5.22.1, Python 2.7.10 , Python 3.4.3, Ruby 2.2.3, Lua 5.3.0, Tcl 8.6.4, libXpm.

Excellent! What I downloaded (2.7.10)! Wait...

  • :echo has('python') prints 1 as expected.
  • But, "merry christmas!" says vim.

Sorry, this command is disabled, the Python site module cannot be loaded. Windows is not good enough. Oh and merry christmas!

Using tuxproject nightly builds vim 7.4.826 (x64)

I tried using x64 python binary, taking care to remove the x86 version from my Path variable. The same question as above.

Using Kaoriya vim 7.4.something (x64) and Veegee vim 7.4.803

The same question as above.

How about compiling vim?

Windows


I'm not so lazy, well, yes, I ... but I will try to compile it if there is no other way around the problem. I do not want to compile it if it does not solve anything. If only I could understand why these problems occur ...

+6
source share
3 answers

Ok, I managed to solve the problem.

For those who might be interested, the intended version of python was Python 2.7. 9 , not 2.7.10. Installing Python 2.7.9 x86 (and x64) fixed everything for the corresponding version of vim.

+5
source

First of all, you need to check the python version compiled in vim. One way is to edit the gvim executable (for example, for the gvim.exe window) and search for "python \ d * .dll \ c" as indicated in the vim manual. However, at startup :echo has('python3') || has ('python') :echo has('python3') || has ('python') it can give you a hint that vim cannot find and load python27.dll or python32.dll, so you can guess that python is also compiled using vim.

Once you have determined the correct version of python and if your python is installed elsewhere, you can specify the location of pythonthreedll to let vim find it.

:set pythonthreedll=D:\installed\python\python35.dll

check the following again :echo has('python3')

+1
source

I also have this problem, but I did not have to install previous versions.

All I can do is simply set PYTHONHOME=C:\Users\MYUSERNAME\Anaconda2 to my system environment variables! You may need to configure the location if you have not used Anaconda as a python installer.

Note. I am using python 2.7.11 and 3.5 (both are installed via Anaconda 64-bit)

PS. Make sure PYTHONHOME is printed correctly, no underscores. And it should only point to the location of Python 2. Do not point to the Python 3 folder.

SFC. It turns out that if you install PYTHONHOME , your working python3 command on the terminal will crash, so I no longer suggest this.

0
source

All Articles