29
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NeoVim用のPython環境を整える

Posted at

社内の機械学習読書会のためにanaconda入れたら、NeoVimがPython3環境でneovimなんてモジュールねーよ!エラーを出し始めたので、ちゃんとする。何が辛いって、Denite動かなくなったのがツラい。

$ brew install pyenv
$ brew install pyenv-virtualenv

READMEにしたがって、パスを通しておく

~/.bash_profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

パスを通したら環境を作る

# インストール可能なPythonのバージョンを確認
$ pyenv install --list
# インストール済みのPythonバージョンを確認
$ pyenv versions

# python2環境
$ pyenv install 2.7.15
$ pyenv virtualenv 2.7.13 neovim2
$ pyenv activate neovim2
$ pip2 install neovim
$ pyenv which python

#python3環境
$ pyenv install 3.5.3
$ pyenv virtualenv 3.5.3 neovim3
$ pyenv activate neovim3
$ pip install neovim
$ pyenv which python

これで環境ができたので、NeoVimの設定ファイルにパスを書いておく

.config/nvim/init.vim
" for Python
let g:python_host_prog = $PYENV_ROOT.'/versions/neovim2/bin/python'
let g:python3_host_prog = $PYENV_ROOT.'/versions/neovim3/bin/python'

:checkhealth で確認してOKなら成功。

29
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?