Vim中的错误:"YouCompleteMe unavailable: This package should not be accessible on Python 3"



当我尝试在vim中使用YouCompleteMe插件时,我得到以下错误:

YouCompleteMe unavailable: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted

然而,我只有在我的虚拟环境中打开vim时才会得到这个错误。当虚拟环境不活跃时,它可以正常工作。我的猜测是YouCompleteMe是用python2编写的,由于某种原因无法从虚拟环境中看到python2解释器,但我不确定如何修复它。似乎没有关于这个主题的Stack Overflow问题,但是在ycm-users Google Group中出现了一个类似的问题,并且没有得到回答。

我在Ubuntu 14.04上,使用vim 7.4版本。

看起来是个bug:

https://github.com/Valloric/ycmd/pull/578

在PR #448中,我假设site-packages路径总是放在标准库路径之后,这样如果我们在第一个site-packages路径之前插入python-future模块,它就必须在标准库之后。事实证明,当将站点包路径添加到PYTHONPATH环境变量时,例如,在使用软件ROS时,情况并非如此。见问题Valloric/YouCompleteMe#2186。当发生这种情况时,Python -future模块将在Python 3上引发以下异常:

 ImportError: This package should not be accessible on Python 3.
 Either you are trying to run from the python-future src folder or
 your installation of python-future is corrupted.

我们通过在sys中查找标准库路径来防止这种情况。路径,并在其后面插入python-future模块。如果找不到它,抛出异常,因为没有它YCM和ycmd就不能工作。

修复Valloric/YouCompleteMe # 2186

合并了上面的pull请求后,你应该能够通过pull更新(或者克隆repo,如果还没有的话)并重新安装来解决这个问题。

听起来好像你在virtualenv中使用了using python 3。就vim而言,您正在运行ycm

不支持的python 3。https://github.com/Valloric/YouCompleteMe/issues/1140

一种解决方法是从虚拟环境外部打开vim

相关内容

最新更新