ubuntu 安装 pythonenv

This will get you going with the latest version of pyenv and make it easy to fork and contribute any changes back upstream.

  1. Check out pyenv where you want it installed. A good place to choose is $HOME/.pyenv (but you can install it somewhere else).

    $ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
    
  2. Define environment variable PYENV_ROOT to point to the path where pyenv repo is cloned and add $PYENV_ROOT/binto your $PATH for access to the pyenv command-line utility.

    $ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
    $ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
    

    Zsh note: Modify your ~/.zshenv file instead of ~/.bash_profile. Ubuntu note: Modify your ~/.bashrc file instead of ~/.bash_profile.

  3. 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 'eval "$(pyenv init -)"' >> ~/.bash_profile
    

    Zsh note: Modify your ~/.zshenv file instead of ~/.bash_profile. Ubuntu note: Modify your ~/.bashrc file instead of ~/.bash_profile.

    General warning: There are some systems where the BASH_ENV variable is configured to point to .bashrc. On such systems you should almost certainly put the abovementioned line eval "$(pyenv init -) into .bash_profile, andnot into .bashrc. Otherwise you may observe strange behaviour, such as pyenv getting into an infinite loop. See #264for details.

  4. Restart your shell so the path changes take effect. You can now begin using pyenv.

    $ exec $SHELL
    
  5. Install Python versions into $PYENV_ROOT/versions. For example, to download and install Python 2.7.8, run:

    $ pyenv install 2.7.8

转载于:https://www.cnblogs.com/earendil/p/5552409.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值