zoukankan      html  css  js  c++  java
  • Ubuntu安装pyenv实现python多版本控制

    Ubuntu安装pyenv实现python多版本控制

    git clone git://github.com/yyuu/pyenv.git ~/.pyenv
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init -)"' >> ~/.bashrc
    exec $SHELL -l
    

    查看可安装的版本

    pyenv install --list
    

    比如安装python2.7.14和python3.6.3版本

    pyenv install 2.7.14 -v
    pyenv install 3.6.3 -v
    

    设置其为全局python

    pyenv global 2.7.14 3.6.3
    

    查看是否安装成功

    ltq@lab:~$ python
    Python 2.7.14 (default, Nov 25 2017, 23:00:16) 
    [GCC 5.4.0 20160609] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    ltq@lab:~$ python3
    Python 3.6.3 (default, Nov 27 2017, 22:54:07) 
    [GCC 5.4.0 20160609] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    

    另外,每当你增删了 Python 版本或带有可执行文件的包(如 pip)以后,都应该执行一次本

    pyenv rehash
    

    更多命令参考pyenv-github,或者

    ltq@lab:~$ 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
    
    See `pyenv help <command>' for information on a specific command.
    For full documentation, see: https://github.com/pyenv/pyenv#readme
    

    https://github.com/pyenv/pyenv

  • 相关阅读:
    srvany.exe和instsrv.exe_2
    srvany.exe和instsrv.exe
    C# “国密加密算法”SM系列的C#实现方法
    DMZ讲解
    java 判断字符串是否为json格式
    MFC DrawText如何使多行文字居中显示 Demo
    C++ 实现一个日志类
    数据库两个神器【索引和锁】
    CentOS 7.*编译安装PHP8
    Centos添加永久环境变量
  • 原文地址:https://www.cnblogs.com/liutongqing/p/7912562.html
Copyright © 2011-2022 走看看