http://blog.csdn.net/nuccch/article/details/17595161
First, install the Pythonbrew
Multi-version Python management is implemented through the Pythonbrew tool, with Pythonbrew installed first.
Ensure that the system has the following packages before installation
sudo apt-get install Curl build-essential libbz2-dev libsqlite3-dev zlib1g-dev libxml2-dev libxslt1-dev libreadline5 LIBG Dbm-dev libgdb-dev libxml2 libssl-dev tk-dev libgdbm-dev libexpat1-dev Libncursesw5-dev
Start installing Pythonbrew
Use the recommended method to install the website:
CURL-KL Http://xrl.us/pythonbrewinstall | Bash
The above command automatically installs the Pythonbrew in the ~/.pythonbrew directory.
Third, the use of pythonbrew
1. View the version of Python that can be installed
$ pythonbrew List--know
2, install the required Python version, need to install the Curl tool, installation will be completed automatically;
$ pythonbrew Install 3.3.1
3. View the version of Python that is already installed, followed by an * sign for the version that is in use
$ pythonbrew List
4. Select a Python version to use, only valid at the current terminal
$ pythonbrew Use 3.3.1
5, select the python3.3.1 version as the default version of the system (user) to use, will add the path of the version to the path
$ pythonbrew Switch 3.3.1---------------------------------------------------------------------------------------- ---------------------------------------------Note: After installing pythonbrew as described above, execute the command: pythonbrew switch 3.3.1 Unexpectedly cannot switch to the specified Python version correctly, and later discovered that the reason is: after the installation of Pythonbrew is complete, be sure to write the following in the. bashrc file:
[-S "$HOME/.PYTHONBREW/ETC/BASHRC"]] && source "$HOME/.PYTHONBREW/ETC/BASHRC"
and execute: source. BASHRC
This will allow you to switch to the specified version of Python normally.
--------------------------------------------------------------------------------------------------------------- ----------------------
6. Cancel Pythonbrew selected version
$ pythonbrew Off
7, clean the installed version of the source code and installation package
$ pythonbrew Cleanup
8. Specify the Python version to run the file
$ pythonbrew py-p 3.3.1 test.py
9. Delete the Python version
$ pythonbrew Uninstall 3.3.1
Ubuntu 10.10 Installation and use Pythonbrew Introduction