<legend id='gshuV'><style id='gshuV'><dir id='gshuV'><q id='gshuV'></q></dir></style></legend>

    1. <small id='gshuV'></small><noframes id='gshuV'>

        • <bdo id='gshuV'></bdo><ul id='gshuV'></ul>
        <tfoot id='gshuV'></tfoot>
        <i id='gshuV'><tr id='gshuV'><dt id='gshuV'><q id='gshuV'><span id='gshuV'><b id='gshuV'><form id='gshuV'><ins id='gshuV'></ins><ul id='gshuV'></ul><sub id='gshuV'></sub></form><legend id='gshuV'></legend><bdo id='gshuV'><pre id='gshuV'><center id='gshuV'></center></pre></bdo></b><th id='gshuV'></th></span></q></dt></tr></i><div id='gshuV'><tfoot id='gshuV'></tfoot><dl id='gshuV'><fieldset id='gshuV'></fieldset></dl></div>

        如何在 VIM 中指定 Python 解释器版本?

        时间:2023-12-03

        <legend id='JFLcs'><style id='JFLcs'><dir id='JFLcs'><q id='JFLcs'></q></dir></style></legend>
        <i id='JFLcs'><tr id='JFLcs'><dt id='JFLcs'><q id='JFLcs'><span id='JFLcs'><b id='JFLcs'><form id='JFLcs'><ins id='JFLcs'></ins><ul id='JFLcs'></ul><sub id='JFLcs'></sub></form><legend id='JFLcs'></legend><bdo id='JFLcs'><pre id='JFLcs'><center id='JFLcs'></center></pre></bdo></b><th id='JFLcs'></th></span></q></dt></tr></i><div id='JFLcs'><tfoot id='JFLcs'></tfoot><dl id='JFLcs'><fieldset id='JFLcs'></fieldset></dl></div>
          <bdo id='JFLcs'></bdo><ul id='JFLcs'></ul>
            <tbody id='JFLcs'></tbody>

                <tfoot id='JFLcs'></tfoot>
                • <small id='JFLcs'></small><noframes id='JFLcs'>

                • 本文介绍了如何在 VIM 中指定 Python 解释器版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  为了在 Vim 中用插件编写 C++,Clang_complete.
                  安装后出现这个错误:

                  In order to write C++ in Vim with plugin, Clang_complete.
                  After installing, this error occurs:

                  Error detected while processing function <SNR>14_ClangCompleteInit..<SNR>14_initClangCompletePython:
                  clang_complete: No python support available.
                  Cannot use clang library
                  Compile vim with python support to use libclang
                  

                  但是我的vim同时支持python和python3.+python/dyn +python3/dyn
                  然后我检查我的 python 解释器:

                  But my vim supports both python and python3. +python/dyn +python3/dyn
                  then I check my python interpreter:

                  :echo has('python')      # output is 0
                  :echo has('python3')     # output is 1
                  

                  所以,我认为原因是我的vim默认动态加载python3解释器.
                  我可以更改 python 解释器吗?或者设置python的默认动态加载版本?

                  So, I think the reason is my vim dynamic load python3 interpreter by default.
                  Can I change python interpreter? or set default dynamic load version of python?

                  推荐答案

                  您可能不想(或至少不应该)将 python3 设置为 vim 的默认 Python 解释器,因为那时您的某些(大部分)插件将变得不兼容,例如 YouCompleteMeclang_complete 本身,因为它们没有 python3 支持.通常,支持 python3 的插件让您决定是否要通过添加到您的 .vimrc

                  You probably don't want to (or at least should not) set python3 as the default python interpreter for vim, as then some (most of) your plugins will become incompatible, such as YouCompleteMe and clang_complete itself, because they do not have python3 support. Normally plugins that do support python3 let you decide if you want to use it by adding to your .vimrc

                  let g:syntastic_python_python_exec = 'python3' 
                  

                  解决方案: :echo has('python') 显示 0 实际上是在告诉你 vim 可能不是用 python2.因此,首先检查 vim --version 的输出,您应该能够看到编译器针对其构建 vim 的共享库列表.你看到以下内容了吗?(例如对于python 2.7):

                  Solution: the :echo has('python') showing 0 is actually telling you that vim is perhaps not compiled with python2. So first check the output of vim --version and you should be able to see a list of shared libraries that your compiler has built vim against. Do you see the following? (e.g. for python 2.7):

                  -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7
                  

                  如果没有(或者如果您同时看到 -lpython2.x-lpython3.x 我建议您从源代码编译 vim,将它专门链接到 -lpython2.x.从源代码构建 vim 并不难.首先确保删除所有当前安装的 vim,例如使用 aptitude 你会这样做:

                  If not (or if you see both -lpython2.x and -lpython3.x I suggest you compile vim from source, linking it specifically to -lpython2.x. It is not that difficult to build vim from source. First make sure to remove all your current vim installation, for instance using aptitude you'd do:

                  sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
                  

                  克隆vim mercurial

                  clone vim mercurial

                  hg clone https://code.google.com/p/vim/
                  cd vim
                  

                  然后使用以下标志运行 ./configure:

                  and then run ./configure with the following flags:

                   ./configure --with-features=huge 
                          --enable-cscope 
                          --enable-pythoninterp 
                          --enable-largefile 
                          --with-python-config-dir=/usr/lib/python2.7/config 
                  

                  如果需要,您可能还想链接 rubylua,然后最后运行

                  you might also want to link against ruby and lua if you want, and then finally run

                  make build
                  make install
                  

                  这里是 shell 脚本,它将为您自动化整个过程.这可能有点矫枉过正,但我认为这是您应该如何处理这个问题,以免与您未来的软件包存在兼容性问题.

                  Here is shell script that will automate the whole process for you. This might be a bit of an overkill, but I think this is how you should handle this to not run with compatibility issues with your future packages.

                  这篇关于如何在 VIM 中指定 Python 解释器版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:C++ 的 Sublime Text 自动完成插件? 下一篇:无法解析基于模板的标识符“get".网豆 8.1

                  相关文章

                  <tfoot id='2x2SC'></tfoot>

                  <small id='2x2SC'></small><noframes id='2x2SC'>

                    <bdo id='2x2SC'></bdo><ul id='2x2SC'></ul>
                • <i id='2x2SC'><tr id='2x2SC'><dt id='2x2SC'><q id='2x2SC'><span id='2x2SC'><b id='2x2SC'><form id='2x2SC'><ins id='2x2SC'></ins><ul id='2x2SC'></ul><sub id='2x2SC'></sub></form><legend id='2x2SC'></legend><bdo id='2x2SC'><pre id='2x2SC'><center id='2x2SC'></center></pre></bdo></b><th id='2x2SC'></th></span></q></dt></tr></i><div id='2x2SC'><tfoot id='2x2SC'></tfoot><dl id='2x2SC'><fieldset id='2x2SC'></fieldset></dl></div>

                    1. <legend id='2x2SC'><style id='2x2SC'><dir id='2x2SC'><q id='2x2SC'></q></dir></style></legend>