码迷,mamicode.com
首页 > 编程语言 > 详细

python多版本管理工具pyenv安装

时间:2018-01-15 11:13:29      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:size   virt   nbsp   3.5   pytho   repo   ant   ase   bzip2   

python多版本管理工具pyenv安装

1.作用

  管理python解释器、python版本、python的虚拟环境

  软件下载地址:https://github.com/pyenv/pyenv

2.pyenv软件包安装

a、配置yum源(配置文件内容如下)

vi   CentOS6-Base-163.repo

[base]

name=CentOS-$releasever - Base - 163.com

baseurl=http://mirrors.163.com/centos/6/os/$basearch/

enable=1

gpgcheck=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-$releasever - Updates - 163.com

baseurl=http://mirrors.163.com/centos/6/updates/$basearch/

gpgcheck=0

enable=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - 163.com

baseurl=http://mirrors.163.com/centos/6/extras/$basearch/

gpgcheck=0

enable=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - 163.com

baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/

gpgcheck=0

enabled=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib - 163.com

baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/

gpgcheck=0

enabled=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

b、安装git软件和依赖包

yum install git -y

yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline- devel zlib-devel bzip2-devel

c、创建用户

useradd python

passwd python

d、安装pyenv软件

curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

e、配置环境变量

vim ~/.bash_profile

export PATH="/home/python/.pyenv/bin:$PATH"

eval "$(pyenv init -)"

eval "$(pyenv virtualenv-init -)"

1.1.2  3.使用pyenv软件安装和管理python

a、列出所有可用版本

    pyenv versions

b、安装指定python版本

   pyenv install 3.5.3 -v

 

查看python版本

 python -V

c、创建一个目录让local捆绑在一个目录下

  mkdir -p magedu/projects

  cd magedu/projects/

  pyenv local 3.5.3----------------#让python版本捆绑在一个目录下

  python -V

  Python 3.5.3

  cd-------#你看如果在其它目录,python版本就是系统默认的2.6,local登录基本做到隔离

  python -V

  Python 2.6.6


python多版本管理工具pyenv安装

标签:size   virt   nbsp   3.5   pytho   repo   ant   ase   bzip2   

原文地址:http://blog.51cto.com/11310506/2060920

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!