doc: provide the python engine in a virtualenv
* Documents how to use `pyenv` to provide a virtual environment for the python engine. Co-Authored-by: iGor milhit <igor@milhit.ch>main
parent
7909b50953
commit
0645bda9f4
47
README.md
47
README.md
|
@ -10,7 +10,7 @@ I'm using the [nord color scheme][5].
|
||||||
|
|
||||||
## To do
|
## To do
|
||||||
|
|
||||||
- [ ] Document how to use `pyenv` to provide a python engine.
|
- [x] Document how to use `pyenv` to provide a python engine.
|
||||||
- [ ] Identify the python package dependencies.
|
- [ ] Identify the python package dependencies.
|
||||||
- `jedi`.
|
- `jedi`.
|
||||||
- `jedi-language-server`.
|
- `jedi-language-server`.
|
||||||
|
@ -63,6 +63,50 @@ export FZF_DEFAULT_OPTS="--preview='bat --style=numbers --color=always --line-ra
|
||||||
|
|
||||||
See the `fzf` documentation: <https://github.com/junegunn/fzf#preview-window>
|
See the `fzf` documentation: <https://github.com/junegunn/fzf#preview-window>
|
||||||
|
|
||||||
|
## Provide an virtual environment for python engine
|
||||||
|
|
||||||
|
Benefit: having a separate virtual environment for your editor than the one
|
||||||
|
your working into.
|
||||||
|
|
||||||
|
Install `pyenv` with the [`pyenv-installer`][9].
|
||||||
|
|
||||||
|
Install the python version you need with `pyenv`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyenv install 3.9.9
|
||||||
|
```
|
||||||
|
|
||||||
|
Create and name the virtual environment for neovim:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyenv virtualenv 3.9.9 neovim
|
||||||
|
```
|
||||||
|
|
||||||
|
Activate the virtual environment and fetch the python path:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyenv activate neovim
|
||||||
|
pyenv which python #Note the provided path
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the following line to your `init.vim`:
|
||||||
|
|
||||||
|
```init.vim
|
||||||
|
let g:python3_host_prog = '/full/path/to/neovim/bin/python
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the python dependencies in the virtual environment as it is activated:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install neovim pynvim …
|
||||||
|
```
|
||||||
|
|
||||||
|
To deactivate the virtual environment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyenv deactivate
|
||||||
|
```
|
||||||
|
|
||||||
[1]: https://github.com/junegunn/vim-plug
|
[1]: https://github.com/junegunn/vim-plug
|
||||||
[2]: https://github.com/BurntSushi/ripgrep
|
[2]: https://github.com/BurntSushi/ripgrep
|
||||||
[3]: https://github.com/ggreer/the_silver_searcher
|
[3]: https://github.com/ggreer/the_silver_searcher
|
||||||
|
@ -70,3 +114,4 @@ See the `fzf` documentation: <https://github.com/junegunn/fzf#preview-window>
|
||||||
[5]: https://www.nordtheme.com/ports/vim
|
[5]: https://www.nordtheme.com/ports/vim
|
||||||
[7]: https://github.com/junegunn/vim-plug#installation
|
[7]: https://github.com/junegunn/vim-plug#installation
|
||||||
[8]: https://www.gitmemory.com/ryanoasis/nerd-fonts
|
[8]: https://www.gitmemory.com/ryanoasis/nerd-fonts
|
||||||
|
[9]: https://github.com/pyenv/pyenv-installer
|
||||||
|
|
Loading…
Reference in New Issue