Ubuntu - Pyenv1 [pyenv 安装]

2020-09-03  本文已影响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).
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.
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.
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.
exec "$SHELL"
  1. Install Python build dependencies before attempting to install a new Python version.
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.
pyenv install 2.7.8
上一篇 下一篇

猜你喜欢

热点阅读