编译了Python支持的Vim却看不到sys版本
我编译了Vim的开发版本,并且同时支持Python 2和Python 3。在运行vim --version
时,输出中显示了+python/dyn
和+python3/dyn
,这说明它们都被支持了。我用以下命令运行了配置文件:
./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
但是,当我在Vim中运行:python import sys; print(sys.version)
时,得到的结果是:
E448: Could not load library function _PyArg_Parse_SizeT
E263: Sorry, this command is disabled, the Python library could not be loaded.
这是什么原因呢?我发现是因为YouCompleteMe这个插件说它需要Vim支持2.x版本的Python。
谢谢
1 个回答
21
我在我的Debian系统上遇到过类似的问题。如果你使用的是基于Debian的系统,你不能同时加载两个Python库。这就是为什么当你设置 --enable-python-interp
和 --enable-python3-interp
时,它们总是带有 /dyn 后缀。
如果你的vim插件不需要两个版本,你只需选择其中一个版本并坚持使用它。下面的链接提供了更多信息。
附注:如果你在Windows上也尝试过,加载任一Python版本都是可以的,所以在那边 /dyn 不是问题。