Ubuntu manages python versions via Pyenv

There are many tutorials for installing and using Pyenv on the Internet, but there are many tutorials that have pitfalls in the actual measurement. After many comparisons, I found that the following tutorials are available, and the content is comprehensive and shared with you.

First install pyenv family bucket

 curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

Configure environment variables to ~/.bashrc, and enter source ~/.bashrc to take effect after the configuration is complete

1 export PYENV_ROOT="$HOME/.pyenv"
2 export PATH="$PYENV_ROOT/bin:$PATH"
3 eval "$(pyenv init -)"
4 eval "$(pyenv virtualenv-init -)"

Check if the installation is correct:

pyenv doctor

renew

pyenv update

View Installable Versions

 pyenv install --list

Install the specified version of python

pyenv install 3.6.0

Displays the installed version, with an asterisk the currently applicable version

pyenv versions

set priority

#globalgloballocallocal shell terminal
#Priority or permission global is the lowest, usually set local as the highest permission, rarely set a certain version as shell
pyenv local 3.6.5
pyenv global 2.7.12

uninstall

pyenv uninstall 3.5.3

Summary: The above contains common configurations. If you want to understand the principle in depth, please check the documentation, or refer to my quote below. The author of the original text is a bit capricious and the content is quite complete, but the code example is unbearable and can be used for reference. It is recommended to read the documentation for in-depth research. , this article can be used as a quick start.

Quote: https://zhuanlan.zhihu.com/p/25990928

github: https://github.com/pyenv/pyenv#choosing-the-python-version

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324591095&siteId=291194637