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

Ubuntu安装pyenv实现python多版本控制的更多相关文章

  1. Ubuntu安装pyenv实现多版本控制

    Ubuntu安装pyenv实现多版本控制 git clone git://github.com/yyuu/pyenv.git ~/.pyenv echo 'export PYENV_ROOT=&quo ...

  2. Ubuntu通过Pyenv管理python版本

    网上安装使用Pyenv的教程很多,但是实测有很多教程有坑,经过多家比较发现下面的教程可用,内容全面,与大家分享. 首先安装pyenv全家桶 curl -L https://raw.githubuser ...

  3. ubuntu安装pyenv

    安装依赖包 bash {.line-numbers} sudo apt-get update sudo apt-get install build-essential python-dev pytho ...

  4. 在Ubuntu 18.04中安装pyenv(Python多版本管理工具)

    最近正在重头梳理Python的基础知识,为了更好地使用Python进行开发,防止发生版本混乱(不同的第三方库有可能因为Python版本不兼容而报错),所以需要使用pyenv进行版本管理. *** 通常 ...

  5. uBuntu安装其他版本Python

    问题描述:阿里云服务器uBuntu版本为16.04,默认Python版本为2.7.12和3.5.2,但是FastAPI,仅支持3.6+版本,因此需要更高版本的Python. 注意:系统自带的Pytho ...

  6. Ubuntu安装MySQL和Python库MySQLdb步骤

    一.安装MySQL服务器和客户端 执行以下命令: sudo apt-get install mysql-server-5.6 mysql-client-5.6 sudo apt-get install ...

  7. ubuntu安装pip和python

    安装pip2sudo apt-get install pip 这样安装的是pip2不支持Python3.x,可以使用如下命令安装pip3 sudo apt-get install python3-pi ...

  8. Python 基础之在ubuntu系统下安装双版本python

    前言:随着python升级更新,新版本较于老版本功能点也有不同地方,作为一个初学者应该了解旧版本的规则,也要继续学习新版本的知识.为了能更好去学习python,我在ubuntu安装python2和py ...

  9. ubuntu下安装多版本Python

    今天一不小心又把ubuntu系统给完坏了,因为我把python3卸载了,然后就...好了,不废话了,接下来就说一下如何在ubuntu下管理python的多个版本.我这里使用的是一个叫pyenv的Pyt ...

随机推荐

  1. JS实现将数字金额转换为大写人民币汉字

    function convertCurrency(money) { //汉字的数字 var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', ...

  2. MyBatis学习资料

    中文文档:http://www.mybatis.org/mybatis-3/zh/index.html http://blog.csdn.net/neosmith/article/details/61 ...

  3. WMS程序部署

    UI部署UI-20190107-landor-修改什么BUG.JAR162\163 APP部署 外部JSP部署 备份META这个SCHEMA

  4. ASP.NET网站不能在VS中调试

    点击VS2010工具栏中绿色的小箭头运行网站没问题,按说运行后,应该处于正在运行状态,这个小箭头会变成灰色.但是没有变化,仍然是绿色的小箭头.所以设置断点根本没有截获.任务栏右下角显示的Develop ...

  5. PDO查询语句结果中文乱码

    PDO::MYSQL_ATTR_INIT_COMMAND (整数)连接到MySQL服务器时执行的命令.重新连接时会自动重新执行.请注意,此常量只能driver_options 在构建新的数据库句柄时在 ...

  6. 第一次博客作业 <西北师范大学| 周安伟>

     1.助教博客链接:https://home.cnblogs.com/u/zaw-315/ 2.本周点评的作业数:3份,有留言互动. 3.本周点评有困难的地方: https://www.cnblogs ...

  7. 连接HTTP服务器

    一.前提 Android 系统上面默认所有Http的请求都被阻止了. 需要在androidmanifest.xml的 application标签上加入 android:usesCleartextTra ...

  8. 使用FFmpeg解码并用swscale将YUV转为RGB

    #include <stdio.h> #include <libavcodec/avcodec.h> #include <libavformat/avformat.h&g ...

  9. 记忆化搜索 P1464 Function

    题目描述 对于一个递归函数w(a,b,c) 如果a≤0 or b≤0 or c≤0就返回值1. 如果a>20 or b>20 or c>20就返回w(20,20,20) 如果a< ...

  10. 将IP转换为16进制,用于IPv4-IPv6

    # --*-- coding: utf-8 --*--# create by xiaocaiji while 1: str_ip = input("input a IP:") li ...