简体   繁体   English

python 2在vim中的支持

[英]python 2 support in vim

I am trying to set up YouCompleteMe, a code-completion plugin for vim. 我正在尝试设置YouCompleteMe,一个vim的代码完成插件。 When I run vim, it gives me this error message: "YouCompleteMe unavailable: requires python 2.x". 当我运行vim时,它给了我这个错误消息:“YouCompleteMe不可用:需要python 2.x”。 I have the correct version of python installed on my ubuntu machine and this confused me. 我在我的ubuntu机器上安装了正确版本的python,这让我很困惑。 After some research, I have found that I needed python2 support in vim , not just on my system ( https://github.com/Valloric/YouCompleteMe/issues/35 ). 经过一些研究,我发现我需要在vim中支持python2,而不仅仅是在我的系统上( https://github.com/Valloric/YouCompleteMe/issues/35 )。 How can I do this? 我怎样才能做到这一点? I was unable to find a similar answer anywhere. 我无法在任何地方找到类似的答案。

Thanks in advance for the help! 在此先感谢您的帮助!

Try aptitude install vim-nox or aptitude install vim-gnome if you want the GUI. 如果你想要GUI,请尝试aptitude install vim-noxaptitude install vim-gnome vim-python is a virtual package provided by either of these. vim-python是由其中任何一个提供的虚拟包。

By default, Ubuntu has vim-tiny installed, which has a bunch of the options switched off. 默认情况下,Ubuntu安装了vim-tiny ,关闭了一堆选项。

It means your need python2 support in vim, not just in your system. 这意味着你需要在vim中支持python2,而不仅仅是在你的系统中。 To test whether your vim support python, execute the following command: 要测试你的vim是否支持python,请执行以下命令:

vim --version | vim --version | grep python grep python

If you find "+python" in the output your vim support python2, "-python" means your vim don't support python2, you need recompile vim with python flag via the vim source. 如果在输出中找到“+ python”,你的vim支持python2,“ - python”意味着你的vim不支持python2,你需要通过vim源重新编译带有python标志的vim。

On windows platform try the following command: 在Windows平台上,尝试以下命令:

nmake -f Make_mvc.mak FEATURES=huge PYTHON=D:\\Python27 PYTHON_VER=27 GUI=yes IME=yes nmake -f Make_mvc.mak FEATURES = huge PYTHON = D:\\ Python27 PYTHON_VER = 27 GUI = yes IME = yes

on Linux platform try the folowing command: 在Linux平台上尝试以下命令:

./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.6/config make make install ./configure --enable-pythoninterp --with-python-config-dir = / usr / lib / python2.6 / config make make install

more details see: 更多细节见:

compiling vim with python support 用python支持编译vim

https://github.com/Valloric/YouCompleteMe/issues/35 https://github.com/Valloric/YouCompleteMe/issues/35

The problem was that the YouCompleteMe fails if both python3 and python2 support are compiled into Vim. 问题是如果python3和python2支持都被编译到Vim中,YouCompleteMe会失败。 Both version can't be used so the first one touched will prevent the other one from working. 两个版本都不能使用,因此触及的第一个版本将阻止另一个版本工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM