Vim-ipython failed to execute on Windows 7
I installed iPython from Anaconda on Windows 7. (No python installed there previously). I can run ipython with no problem.
Then I installed the vim-ipython plugin. In vim, when I run
:IPython
I got it:
E492 Not an editor command.
I checked the vim version:
:version
+python/dyn
I have checked (in vim)
:python import sys
E370 Could not load python27.dll
Run python on cmd:
Python 2.7.5 |Anaconda 1.7.0 (64-bit)| (default, Jul 1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)]
Could you please tell me what is wrong with this setup? Thank.
Edit: I tried (in Vim):
:echo has("python")
0
I'm really confused!
Edit 2: Thanks everyone for the help. I decide to build / compile vim 64-bit on windows. I downloaded MinGW-w64, but I don't know how to use it: I cannot find "make". (I remember that mingw-32-make was in the 32-bit version, but it was not in the 64-bit version.)
source to share
On windows for vim, to find the DLL path for python, it must be present in $PATH
. There are several ways to achieve this:
-
Editing the registry. In wine, I achieve this by adding a new path to the key value
PATH
stored inHKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
by creating a filepath.reg
:REGEDIT4 [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment] "PATH"="{put old value of %PATH% here};C:\\path\\to\\python\\dll"
and it works
regedit path.reg
, but I think HKEY_LOCAL_MACHINE is a little overkill and you need something under HKEY_CURRENT_USER. I use it with wine (windows emulator) anyway, so I don't care. You can runregedit
with no arguments and try to find something in there. - AFAIR there is a way to set
%PATH%
in the links file you use to start vim. -
Maybe just paste the following into vimrc:
let $PATH.=';C:\path\to\python\dll'
Note. None of the advice will work if vim was compiled with a different version of python support. Also if some customization flags (like debug support) differ between python from anaconda installer and python used by someone who needs to compile the vim error message. I don't know if the error message will change if vim is 32-bit and your python is 64-bit, but the python download will most likely fail.
source to share
The troubleshooting result shows that your Vim is compiled with dynamically loaded Python ( +python/dyn
), but the error you are getting has('python') == 0
indicates that the Python interpreter cannot be loaded successfully. The IPython plugin probably has a guard clause that prevents it from loading if Python is not available.
You need to fix the Python integration in Vim, either by making this DLL available to Vim (so there are no bugs and has('python') == 1
), or (in extreme cases) compiling Vim yourself.
source to share