gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 05:25:14 24 4
gpt4 key购买 nike

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

YouCompleteMe 不可用:在 Python 3 上不应访问此包。您正尝试从 python-future src 文件夹运行,或者您安装的 python-future 已损坏

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

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

最佳答案

看起来这是一个错误:

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

In PR #448, I made the assumption that the site-packages paths are always placed after the standard library path so that if we insert the python-future module just before the first site-packages path, it would necessary be after the standard library. Turns out that it is not true when a site-packages path is added to the PYTHONPATH environment variable, e.g, when using the software ROS. See issue Valloric/YouCompleteMe#2186. When this happens, the python-future module will raise the following exception on 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.

We prevent this by looking for the standard library path in sys.path and by inserting the python-future module just after it. If we can't find it, we raise an exception since YCM and ycmd cannot work without it.

Fixes Valloric/YouCompleteMe#2186

合并上述拉取请求后,您应该能够通过拉取更新(或者如果还没有克隆存储库)并重新安装来解决问题。

关于python - Vim : "YouCompleteMe unavailable: This package should not be accessible on Python 3" 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39008318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com