在Ubuntu GNOME3上使用VIM和Anaconda Python安装

时间:2022-03-20 06:56:24

I'm attempting to use VIM to edit and run python code. I would like to use the Anaconda install (Python 3.6.0 :: Anaconda 4.3.1 (64-bit)) when executing Python code.

我正在尝试使用VIM来编辑和运行python代码。我想在执行Python代码时使用Anaconda安装(Python 3.6.0 :: Anaconda 4.3.1(64位))。

Checking the version of Python from vim...

从vim检查Python的版本...

:!which python
/usr/bin/python  

:!which python3
/usr/local/bin/python3

Checking the version of Python from the terminal...

从终端检查Python的版本......

$ which python
/home/richard/anaconda3/bin/python

$ which python3
/home/richard/anaconda3/bin/python3

$ python -V
Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
$ python3 -V
Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

I installed VIM using instructions from youcompleteme, although I haven't yet installed any plugins. I configured vim for Python3 support. https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

我使用youcompleteme的说明安装了VIM,虽然我还没有安装任何插件。我为vim配置了Python3支持。 https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

$ ./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp=yes \
            --enable-python3interp=yes \
            --with-python3-config-dir=/usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu \
            --enable-perlinterp=yes \
            --enable-luainterp=yes \
            --enable-gui=gnome2 --enable-cscope --prefix=/usr \
            --with-compiledby=Richard

The .bashrc file has the following lines...

.bashrc文件包含以下行...

# added by Anaconda3 4.3.1 installer
export PATH="/home/richard/anaconda3/bin:$PATH"

My goal is to execute the anaconda install of Python from VIM and use pandas, numpy, etc. Any help or suggestions is greatly appreciated!

我的目标是从VIM执行anaconda安装Python并使用pandas,numpy等。非常感谢任何帮助或建议!

1 个解决方案

#1


0  

I had the same problem. When I looked at what version of python my vim was compiled to use it was 3.5.The latest Anaconda is installing python 3.6 and so my vim did not know how to look for that. Try :version in vim and see what you get. I get "/nodefaultlib:python27.lib /nodefaultlib:python35.lib"

我有同样的问题。当我看到我的vim编译使用的python版本是3.5时。最新的Anaconda正在安装python 3.6,所以我的vim不知道如何查找。尝试:vim中的版本,看看你得到了什么。我得到“/nodefaultlib:python27.lib /nodefaultlib:python35.lib”

When I uninstalled Anaconda, installed python 3.5, updated all my modules for 3.5 (e.g. numpy, etc.) vim found it as python3 and used it correctly. I can't speak for all your vim add-ins.

当我卸载Anaconda,安装了python 3.5,更新了我的所有模块3.5(例如numpy等)vim发现它为python3并正确使用它。我不能代表你所有的vim加载项。

One can use an older version of Anaconda (4.2.0) that installs python 3.5 and the Anaconda install page has other options/instructions for using python 3.5. Or look around for a compiled version of vim that uses python 3.6.

可以使用安装python 3.5的旧版Anaconda(4.2.0)和Anaconda安装页面使用python 3.5的其他选项/说明。或者四处寻找使用python 3.6的vim编译版本。

#1


0  

I had the same problem. When I looked at what version of python my vim was compiled to use it was 3.5.The latest Anaconda is installing python 3.6 and so my vim did not know how to look for that. Try :version in vim and see what you get. I get "/nodefaultlib:python27.lib /nodefaultlib:python35.lib"

我有同样的问题。当我看到我的vim编译使用的python版本是3.5时。最新的Anaconda正在安装python 3.6,所以我的vim不知道如何查找。尝试:vim中的版本,看看你得到了什么。我得到“/nodefaultlib:python27.lib /nodefaultlib:python35.lib”

When I uninstalled Anaconda, installed python 3.5, updated all my modules for 3.5 (e.g. numpy, etc.) vim found it as python3 and used it correctly. I can't speak for all your vim add-ins.

当我卸载Anaconda,安装了python 3.5,更新了我的所有模块3.5(例如numpy等)vim发现它为python3并正确使用它。我不能代表你所有的vim加载项。

One can use an older version of Anaconda (4.2.0) that installs python 3.5 and the Anaconda install page has other options/instructions for using python 3.5. Or look around for a compiled version of vim that uses python 3.6.

可以使用安装python 3.5的旧版Anaconda(4.2.0)和Anaconda安装页面使用python 3.5的其他选项/说明。或者四处寻找使用python 3.6的vim编译版本。