美文网首页
Ubuntu - Pyenv1 [pyenv 安装]

Ubuntu - Pyenv1 [pyenv 安装]

作者: 庄周幻梦 | 来源:发表于2020-09-03 19:34 被阅读0次

Ubuntu19.10 environment

转载:https://github.com/pyenv/pyenv#basic-github-checkout

  1. Check out pyenv where you want it installed.A good place to choose is $HOME/.pyenv (but you can install it somewhere else).
  • 检查要安装的pyenv, $HOME/.pyenv是一个不错的选择(使用git命令之前需要先安装git)
sudo apt install git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
  1. Define environment variable PYENV_ROOT to point to the path where pyenv repo is cloned and add $PYENV_ROOT/bin to your $PATH for access to the pyenv command-line utility.
  • 定义环境变量"PYENV_ROOT"指向克隆pyenv repo的路径,然后将" $PYENV_ROOT / bin "添加到$PATH 中以访问pyenv命令。
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
  1. Add Pyenv init to your shell to enable shims and autocompletion .Please make sure eval "$(pyenv init -)" is placed toward the end of the shell configuration file since it manipulates PATH during the initialization.
  • 在shell中添加Pyenv init以启用填充和自动补全功能。请确保将eval "$(pyenv init-)"放在shell配置文件的末尾,因为它会在初始化过程中操纵* PATH *。
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
  1. Restart your shell so the path change take effect. You can now begin using pyenv.
  • 重新shell,以使路径更改生效。 您现在可以开始使用pyenv。
exec "$SHELL"
  1. Install Python build dependencies before attempting to install a new Python version.
  • 在尝试安装新的Python版本之前,请先安装Python构建依赖项。
sudo apt-get update; sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
  1. Install Python versions into $(pyenv root)/versions.
  • 将Python版本安装到$(pyenv root)/ versions中。
pyenv install 2.7.8

相关文章

网友评论

      本文标题:Ubuntu - Pyenv1 [pyenv 安装]

      本文链接:https://www.haomeiwen.com/subject/dcposktx.html