Pyenv部署

一、Git克隆方式

  1.安装git

    yum -y install git

  2.克隆pyenv到本地

    git clone https://github.com/pyenv/pyenv.git ~/.pyenv

  3.配置环境变量

1 [root@localhost ~]# echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
2 [root@localhost ~]# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
3 [root@localhost ~]# source .bash_profile 
4 [root@localhost ~]# pyenv --version
5 pyenv 1.2.9-32-g64c0828

  4.pyenv初始化到当前用户shell

echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile

  5.重启shell并开始使用pyenv

  

[root@localhost ~]# exec "$SHELL"
[root@localhost ~]# pyenv -h
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

猜你喜欢

转载自www.cnblogs.com/yunxiaobai8/p/10613750.html