Skip to main content

How to Install the Python And Switch of Environment?

How To Install The Python And Switch Of Environment?

How to install the python and switch of environment?

Introduction

Sometimes, we need to different python versions development. The pyenv is very easier to help us switching any python versions.

Equipment

Operation System: Ubuntu 14.04 LTS

Usage

1.. If you haven't used GIT, you should install it before you get started.
$ sudo apt-get install curl git-core

2.. For automatically install pyenv.
$ curl https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

3.. Open up .bashrc located in your home directory with a text editor and add the following.
File Name: .bashrc
# Python environment switch
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
(Save it)

$ source ~/.bashrc

4.. To Verify pyenv is installed properly
$ pyenv --version
pyenv 20140924-1-g737e0f1

5.. List of Python versions.
$ pyenv install –list
Available versions:
2.1.3
2.2.3
2.3.7
2.4
2.4.1
(… More)

6.. To install a python version.
$ pyenv install 3.3.4 -v
/tmp/python-build.20150111112656.5021 ~
Downloading Python-3.3.4.tgz...
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: application/octet-stream
Last-Modified: Tue, 04 Nov 2014 09:32:24 GMT
Expires: Sun, 11 Jan 2015 03:36:56 GMT
Cache-Control: max-age=600
Content-Length: 16843278
Accept-Ranges: bytes
Date: Sun, 11 Jan 2015 03:27:01 GMT
Via: 1.1 varnish
Age: 5
Connection: keep-alive
X-Served-By: cache-ty67-TYO
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1420946816.328055,VS0,VE4793
Vary: Accept-Encoding
-> http://yyuu.github.io/pythons/ea055db9dd004a6ecd7690abc9734573763686dd768122316bae2dfd026412af
(… More)

7.. To list python versions.

$ pyenv versions
* system (set by /home/brianlai/.python-version)
  2.6.6
  3.3.4

8.. To switch another python version.

$ export PYENV_VERSION=3.3.4    
$ pyenv versions    
  system    
  2.6.6    
* 3.3.4 (set by PYENV_VERSION environment variable)    
$ export PYENV_VERSION=system    
$ pyenv versions    
* system (set by PYENV_VERSION environment variable)    
  2.6.6   
  3.3.4   

Exception

None

Reference

[1] http://davebehnke.com/python-pyenv-ubuntu.html

Acknowledge

Thank you (Pyenv) very much for this great development utility.

Popular posts from this blog

Python 日期與時間的處理

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Python 日期與時間的處理

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

Image

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Image

數位影像處理:最佳化處理策略之快速消除扭曲演算法

Image

用10種程式語言做影像二值化(Image binarization)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (04. 人事考勤管理系統)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (06. 題庫測驗系統)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (11. 生產線拍照程式)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (07. 收據列印程式)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (03. 場地預約系統)

Image