Python multiple version management

Source: Internet
Author: User

1. Install Virtualenv by pip


2. Install pyenv (recommended)

Install the relevant Environment pack:

#yum groupinstall "Development tools"

#yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel #readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

安装 pyenv

#curl https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer |bash

或者
git clone git://github.com/yyuu/pyenv.git .pyenv  #.pyenv 为虚拟目录

3.创建环境变量:

[Email protected] ~]# cat/etc/profile.d/pyenv.sh #!/bin/bash################ #export pyenv_root= "$HOME/.pyenv" Export path= "$PYENV _root/bin: $PATH" eval "$ (pyenv init-)" [[Email protected] ~] #source/etc/profile.d/pyenv.sh[[email Protected] ~]# cat ~/.pip/pip.conf #设置pip国内源 (optional); [Global]index-url = Http://pypi.douban.com/[[email protecte D] ~]#

4.测试

[[email protected] ~]# pyenv install --list   #显示可安装的包 [[email protected ] ~]# pyenv install 3.4.3    #安装python3.4.3[[email protected] ~]#  pyenv local system     #本地切换系统默认的python版本 [[email protected] ~]#  python -v             # View the current version of the system python 2.7.5[[email protected] ~]# pyenv local 3.4.3       #本地切换python3.4.3 Version [[email protected] ~]# pyenv shell 3.4.3       #和上类似 [[email protected] ~]# python -vpython 3.4.3[[email  Protected] ~] #pyenv  global system[[email protected] ~]# pyenv   versions        #查看系统当前可用的python版本, and the version you are using   system* 3.4.3   (set by /root/.python-versIon 




Python multiple version management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.