安装jedivim失败:vim错误地说没有编译+python

2024-10-01 11:28:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图安装绝地维姆。我是在工作的时候这样做的,所以我必须在Windows中使用gVim。我已经在这个论坛上读过其他几篇文章了。这使我变得更聪明,但仍然不能解决我的问题。在

我做了以下事情:

  1. 已安装病原体
  2. https://github.com/davidhalter/jedi-vim.git克隆了jedi vim,并将其复制到vim目录下的bundle/文件夹中。
  3. 现在,当我打开*.py文件时,vim总是告诉我

    jedi-vim requires vim compiled with +python

    但是“:version”告诉我它是用+python/dyn+python3/dyn编译的。

那么问题是什么呢?在

其他信息:

  • vim版本:7.4
  • 当我使用ctrl+空格自动完成一个python关键字时,它告诉我:

    Error detected while processing function jedi#completions: line 1: E492: Not an editor command: Python jedi_vim.completions()
    Error detected while processing function jedi#completions: line 1: E492: Not an editor command: Python jedi_vim.completions()
    Press ENTER or type command to continue


Tags: anlinenotfunctionerrorvimcommandeditor
3条回答

我不确定你是否还在经历同样的问题,但是在我四处看看之后,我发现了这篇博客文章,它为我解决了这个问题。本质上,它只是重新安装vim(不要删除任何配置文件),然后用正确的标志从vim mercurial repo的源代码重新安装。可能有一个更简短/更简单的方法,但在反复尝试了许多解决方案后,只有这一个有效:

步骤如下: 检查Vim是否使用Python编译:

$ vim  version | ack '(python)'

拆除已安装的Vim版本:

^{pr2}$

安装编译Vim所需的依赖项:

$ sudo apt-get build-dep vim

克隆Vim存储库,编译并安装新版本:

$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim
$ ./configure  enable-pythoninterp
$ make
$ sudo make install

当时的问题是另一个问题。我混淆了vim和python的架构——我使用的是vim64Bit,而pyton是32bit。 一段时间前我已经修复过了,但前几天我不得不重新启动计算机并进行一些microsoft更新。 不幸的是,我的vim(7.4)完全崩溃了。我不得不重新设置我的主目录。那么至少我的维姆RC又可以进入了,但我在维姆的绝地武士仍然不能工作。在

Python在vim中可用,但jedi似乎仍然无法正确加载。 当我键入“len”(在.py文件的开头,应该解释参数的地方有一些奇怪的字符,类似于: ==jedi=0, ==(对象>==jedi==

当我键入“self.”时,它显示“unknown function:pythoncomplete\Complete”

我认为这只是一个配置问题,因为它在重启前就起作用了。 Jedi在全系统范围内安装(使用pip)。如果我试图“再次”安装它,皮普说绝地武士已经安装好了。在

非常感谢您的帮助;—)

+python/dyn表示Python支持不是静态编译的,而是在运行时根据需要动态加载。在

这在python-dynamic帮助部分中有描述:

On MS-Windows the Python library can be loaded dynamically. The |:version| output then includes |+python/dyn|.

This means that Vim will search for the Python DLL file only when needed. When you don't use the Python interface you don't need it, thus you can use Vim without this DLL file.

To use the Python interface the Python DLL must be in your search path. In a console window type "path" to see what directories are used.

The name of the DLL must match the Python version Vim was compiled with. Currently the name is "python24.dll". That is for Python 2.4. To know for sure edit "gvim.exe" and search for "python\d*.dll\c".

(不用担心那里的2.4;我只是碰巧找到了几年前的文档。请阅读您自己的vim副本中的帮助,或者最好按照最后一段的内容进行操作。)

所以,要么你没有Python,要么Python版本错误,它不在你的%PATH%上,vim错误地搜索它,或者它无法加载。在

相关问题 更多 >