This is the method I use to install different versions of python on different virtualenvs, which is also compatible with spacemacs autocompletion.
If you already installed python-virtualenvwrapper from pacman or pip directly, remove it. These steps only work well on a fresh installation.
pacman -S pyenv
yay -S pyenv-virtualenvwrapper
pyenv virtualenvwrapper
add following lines in to your .zshrc file,
eval "$(pyenv init -)"
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
Don’t forget to close and reopen the shell or,
source $HOME/.zshrc
Get the available python versions you can install from pyenv,
pyenv install --list
What I usually use, (it works well with tf1.13. Checkout tested build if you need to use tf.)
pyenv install 3.7.4
list all available python versions,
pyenv versions
switch to python version you want,
pyenv global 3.7.4
pyenv local 3.7.4
Create virtualenv (with virtualenvwrapper),
mkvirtualenv <venv-name>
The following steps make the spacemacs autocompletion working,
pyenv global 3.7.4
mkvirtualenv <venv-name>
workon <venv-name>
pip install flake8 isort yapf python-language-server
Then open the spacemacs and first activate the virtualenv you want, then open the python project.
Activate the virtualenv, then run:
ipython kernel install --user --name=<name-you-want>