如何解决linux vim中的“需要python 2.x支持”,并且我的系统中有python 2.6.6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20160902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve "requires python 2.x support" in linux vim,and it have python 2.6.6 in my system
提问by Firemky
[root@localhost bin]# python -V
Python 2.6.6
[root@localhost bin]# ./vim
UltiSnips requires py >= 2.6 or any py3
YouCompleteMe unavailable: requires Vim compiled with Python 2.x support
i have try it in centos 6.4 ,and fedora 20. It's the same problem. i am new coder ,i really do not know why it happen.
我已经在 centos 6.4 和 fedora 20 中尝试过。这是同样的问题。我是新的编码员,我真的不知道为什么会这样。
回答by romainl
What happens is explained in the message: your vim is not built with python support. The solution is also rather obvious: install vim with python support.
消息中解释了发生的情况:您的 vim 不是用 python 支持构建的。解决方案也很明显:安装支持 python 的 vim。
Use your package manager to install the biggest build available which I think is "vim-enhanced". Hopefully, your package manager will deal with dependencies.
使用你的包管理器安装最大的可用版本,我认为它是“vim-enhanced”。希望您的包管理器能够处理依赖项。
回答by Jokester
That means python support was not included when compiling vim.
这意味着编译 vim 时不包括 python 支持。
Check if your distribution has some package like vim-with-full-features
(I heard that there is no in CentOS), or build it yourself. Happy vimming.
检查您的发行版是否有一些软件包vim-with-full-features
(我听说 CentOS 中没有),或者自己构建它。快乐的维密。
回答by jazzpi
It looks like you didn't install vim with Python support.
看起来您没有安装支持 Python 的 vim。
You can check this by running vim --version
.
您可以通过运行来检查这一点vim --version
。
If you see a -python
string in the output, that means you didn't install it with Python support. +python
means it's installed with Python support.
如果您-python
在输出中看到一个字符串,则表示您没有使用 Python 支持安装它。+python
意味着它安装了 Python 支持。
To resolve this, either find a package in your package manager that installs it with Python support (see other answers) or download the source code and compile it with Python support. (Run the configure
script with --enable-pythoninterp=yes
. If you want Python 3 support to be enabled, use --enable-python3interp=yes
)
要解决此问题,请在您的包管理器中找到一个安装了 Python 支持的包(请参阅其他答案),或者下载源代码并使用 Python 支持对其进行编译。(使用 运行configure
脚本--enable-pythoninterp=yes
。如果要启用 Python 3 支持,请使用--enable-python3interp=yes
)
回答by Sergey Khaylov
With Debian 8, installing vim-nox
helped me.
使用 Debian 8,安装vim-nox
帮助了我。
apt-get install vim-nox
回答by Bay Dam
I think it's because you need to install python-dev. He solved my problem.
我认为这是因为您需要安装python-dev。他解决了我的问题。
$ sudo apt-get install python-dev
$ sudo apt-get install python-dev
回答by dylnmc
Neovim? Anyone?
新维姆?任何人?
Getting set up with neovim and ycm
使用 neovim 和 ycm 进行设置
Installation
安装
On arch, for example, yaourt -S python-neovim
例如,在拱门上, yaourt -S python-neovim
Basically, you need python support.
基本上,您需要python支持。
Setting up neovim
设置 Neovim
mkdir -p ~/.config/nvim/bundle/Vundle.vim/
cp ~/.vimrc ./init.vim
git clone https://github.com/VundleVim/Vundle.vim.git
git clone
nvim ~/.config/nvim/init.vim # edit nvim init file (using nvim, **of course** :)
Using vundle to manage YCM:
使用 vundle 管理 YCM:
Hopefully, you are still inside you ~/.config/nvim/init.vim
... add these lines in order to add Vundleand You Complete Me (YCM)plugins:
希望你仍然在你的内心~/.config/nvim/init.vim
......添加这些行以添加Vundleand You Complete Me (YCM)插件:
set nocompatible
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin('~/.config/nvim/bundle')
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on
NOTE
All of the above lines are required(with the exception of Plugin 'vundleVim/Vundle.vim'
as that just tells vundle to manage itself for updates).
注意
以上所有行都是必需的(除了Plugin 'vundleVim/Vundle.vim'
as 只是告诉 vundle 管理自身以进行更新)。
Now run these commands inside nvim/vimto (1) source the current file and (2) install all the plugins with vundle.
现在在 nvim/vim 中运行这些命令以 (1) 获取当前文件和 (2) 使用 vundle 安装所有插件。
:so %
:PluginInstall
Last step: compiling YCM
最后一步:编译YCM
We need one last step for YCM. (Usually, you do not need to do this with Plugins as they will use vimL or something. However, YCM needs something a bit faster, so we need to do a little something more.)
我们需要 YCM 的最后一步。(通常,您不需要对插件执行此操作,因为它们会使用 vimL 或其他东西。但是,YCM 需要更快的速度,因此我们需要做更多的事情。)
cd ~/.config/nvim/bundle/YouCompleteMe/
python2 install.py
All done!
:)
全部完成!
:)
Getting set up in vim instead
改为在 vim 中进行设置
meh
嗯
If you insist, simply put all of vundle's things inside ~/.vim/bundle/
and then use
如果你坚持,只需将所有 vundle 的东西放在里面~/.vim/bundle/
然后使用
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin('~/.vim/bundle')
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe' " if on arch, I recommend installing vim-youcompleteme-git
call vundle#end()
filetype plugin indent on
inside your ~/.vimrc. Notethe difference in the set rtp+=
AND the call vundle#begin
... in vim and nvim, they point to differentdirectories.
在你的 ~/.vimrc 中。需要注意的差别set rtp+=
和call vundle#begin
在vim和nvim ......,它们指向不同的目录。
回答by Hieu
In Ubuntu/Lubuntu 16.04, I have success with installing vim-gnome-py2
在 Ubuntu/Lubuntu 16.04 中,我安装成功 vim-gnome-py2
sudo apt-get install vim-gnome-py2
My vim --version | grep python
after installing it:
vim --version | grep python
安装后我的:
$ vim --version | grep python
+cryptv +linebreak +python +vreplace
+cscope +lispindent -python3 +wildignore
You may need to remove other packages such as vim-gnome
, vim-gtk
, vim-nox
... to avoid conflicts.
您可能需要删除其他包,例如vim-gnome
, vim-gtk
, vim-nox
... 以避免冲突。
回答by neoben
I solved the issue installing vim-gnome-py2that has python2 interpreter support
我解决了安装具有 python2 解释器支持的vim-gnome-py2的问题
sudo apt-get install vim-gnome-py2
and making it the default alternative using update-alternatives
并使用update-alternatives使其成为默认替代方案
sudo update-alternatives --set vim /usr/bin/vim.gnome-py2
Installing vim-gnome-py2 could not be enough
安装 vim-gnome-py2 还不够
回答by MIkee
In Ubuntu 16.04, I took these steps:
在 Ubuntu 16.04 中,我采取了以下步骤:
cd ~/.vim/bundle
rm -rf YouCompleteMe/
vim +PluginInstall +qall
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
cd ~/.vim/bundle
rm -rf YouCompleteMe/
vim +PluginInstall +qall
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
No problems since then.
从那以后没有问题。
回答by Matt Self
Don't ./configure both python (2) AND python3 interpreters:
不要 ./configure python (2) 和 python3 解释器:
On Ubuntu 16.04 when installing vim from source via:
在 Ubuntu 16.04 上通过以下方式从源安装 vim 时:
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
The enable-pythoninterp
and enable-python3interp
when used together result in a +python/dyn
and +python3/dyn
as features which seems to cause trouble. You'll see this in the "features included (+)" if you run vim --version
.
在enable-pythoninterp
和enable-python3interp
一起使用时导致+python/dyn
并+python3/dyn
作为这似乎造成麻烦的特点。如果您运行vim --version
.
Don't configure both.i.e. Only use one python (or the other) and things will start to function correctly.
不要同时配置。即只使用一个python(或另一个),事情就会开始正常运行。
Looks like this was answered (with more info) here: https://stackoverflow.com/a/23656675/1442914
看起来这里已经回答了(有更多信息):https: //stackoverflow.com/a/23656675/1442914