安装

  1. curl -L https://gitee.com/liujunjie/pyenv-installer/raw/master/bin/pyenv-installer |bash

for bash
Stock Bash startup files vary widely between distributions in which of them source which, under what circumstances, in what order and what additional configuration they perform. As such, the most reliable way to get Pyenv in all environments is to append Pyenv configuration commands to both .bashrc (for interactive shells) and the profile file that Bash would use (for login shells).
在不同的发行版中,Bash启动文件的源文件、环境文件、顺序文件以及执行的附加配置文件差别很大。因此,在所有环境中获得Pyenv的最可靠方法是将Pyenv配置命令附加到.bashrc(用于交互式shell)和Bash将使用的配置文件(用于登录shell)。

First, add the commands to ~/.bashrc:

  1. echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
  2. echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
  3. echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Then, if you have ~/.profile, ~/.bash_profile or ~/.bash_login, add the commands there as well. If you have none of these, add them to ~/.profile.
to add to ~/.profile:

  1. echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
  2. echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
  3. echo 'eval "$(pyenv init -)"' >> ~/.profile

to add to ~/.bash_profile:

  1. echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
  2. echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
  3. echo 'eval "$(pyenv init -)"' >> ~/.bash_profile