简体   繁体   English

在.vimrc文件中执行不同版本的python

[英]Execute different version of python in .vimrc file

I am trying to get powerline.vim to work and the problem is that on setup it is trying to run the wrong version of python. 我正在尝试使powerline.vim正常工作,问题是在安装程序时它试图运行错误版本的python。 This line is causing the problem. 这条线引起了问题。

python from powerline.ext.vim import source_plugin; source_plugin()

How can I change this so that it executes /usr/local/bin/python instead? 如何更改此设置,使其改为执行/usr/local/bin/python

Thanks! 谢谢!

You can't. 你不能 Because you are not using /anything /bin/python . 因为您没有使用/ anything /bin/python The vim binary is linked to the python interpreter library directly. vim二进制文件直接链接到python解释器库。

The library is called /usr/lib/libpythonX.Y.so.Z . 该库称为/usr/lib/libpythonX.Y.so.Z Eg /usr/lib/libpython2.7.so.1 . 例如/usr/lib/libpython2.7.so.1 It's a shared library, so you could use newer version of it (eg changing library paths), but only one that has the same numbers (X, Y and Z). 这是一个共享库,因此您可以使用它的较新版本(例如,更改库路径),但是只有一个具有相同编号(X,Y和Z)的库。 So you can use python 2.7.3 instead of python 2.7.0, but to use python 2.7.3 instead of python 2.6.2, you'll have to recompile vim. 因此,您可以使用python 2.7.3代替python 2.7.0,但是要使用python 2.7.3代替python 2.6.2,则必须重新编译vim。

But I suspect you are just trying to do the things the wrong way around. 但是我怀疑您只是想以错误的方式来做事情。 You should simply try installing powerline into the python version vim uses. 您应该简单地尝试将电源线安装到vim使用的python版本中。

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

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