2014-04-11 36 views
9

我编译了Python 2和Python 3支持的Vim开发版本。 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用Python支持编译Vim,但看不到sys版本

但是在配置文件当我运行: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支持。

感谢

+0

它有可能被编译为2.x的不同版本,你正在使用什么?这只是一个猜测,但C扩展肯定需要针对特定​​版本进行编译。 –

+1

我有[同样的问题在Windows之前](http://stackoverflow.com/questions/22349930/how-can-i-add-with-python-options-by-building-gvim-vim-from-source- code-in-wi),原因是我的python/python3的版本是** 64bit **。在我安装** 32位python/python3 **之后,一切都很好。 – Marslo

+1

为什么它是64位vs 32位? – thaweatherman

回答

13

我对我的Debian盒子类似的问题。如果您使用的是基于Debian的系统,那么您将无法同时加载两个Python库。这就是为什么当你设置--enable-python-interp--enable-python3-interp时,它们总是加载/ dyn后缀。

如果你的vim插件不需要两个版本,你应该选择一个版本并坚持下去。以下链接提供了更多信息。

Explained by Debian maintainer

Vim Python Support

附: - 如果你在Windows上也尝试过这种方法,那么加载Python版本将会起作用,所以/ dyn不是那里的问题。

+0

非常感谢。这解决了我的问题! –