Vim使用Python支持进行编译,但看不到sys版本 [英] Vim compiled with Python support but can't see sys version
问题描述
我用Python 2和Python 3支持编译了Vim的开发版本. vim --version
的输出中有+python/dyn
和+python3/dyn
.我运行了配置文件
G
./configure --enable-pythoninterp --enable-python3interp --with-python-config-dir=/usr/lib64/python2.7/config --with-python3-config-dir=/usr/lib64/python3.3/config --with-x --with-features=huge
I compiled the development version of Vim with both Python 2 and Python 3 support. The output of vim --version
has +python/dyn
and +python3/dyn
in it. I ran the configure file with
g
./configure --enable-pythoninterp --enable-python3interp --with-python-config-dir=/usr/lib64/python2.7/config --with-python3-config-dir=/usr/lib64/python3.3/config --with-x --with-features=huge
但是,当我运行:python import sys; print(sys.version)
时,我会得到
However when I run :python import sys; print(sys.version)
I get
E448: Could not load library function _PyArg_Parse_SizeT
E263: Sorry, this command is disabled, the Python library could not be loaded.
为什么会这样?我发现是因为YouCompleteMe指出它需要使用2.x支持编译的Vim.
Why would this be? I found out because of YouCompleteMe stating that it requires Vim compiled with 2.x support.
谢谢
推荐答案
我在Debian机器上遇到了类似的问题.如果您使用的是基于Debian的系统,则将无法同时加载两个Python库.这就是为什么当您设置--enable-python-interp
和--enable-python3-interp
时,它们总是加载/dyn后缀.
I had a similar issue on my Debian box. If you're using a Debian-based system, you will not be able to load both Python libraries simultaneously. That's why when you set --enable-python-interp
and --enable-python3-interp
they always load with the /dyn suffix.
如果您的vim插件不需要两个版本,则只需选择其中一个版本并坚持使用即可.下面的链接提供了更多信息.
If your vim plugins don't need both versions, you should just pick one of the versions and stick with it. The links below provide more info.
P.S. -如果您也在Windows上尝试过此操作,则可以加载任何一个Python版本,因此/dyn在那里不是问题.
P.S. - In case you tried this on Windows as well, loading either Python version will work, so the /dyn isn't an issue there.
这篇关于Vim使用Python支持进行编译,但看不到sys版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!