Ubuntu 13.04 Default Python version is 2.7, want to do python3 on its development will encounter problems. For example, to use PIP to install a package, the default is to install the Python2 package. If you want to install Python3 's package, you need to use virtualenv.
Virtualenv's official website is in http://www.virtualenv.org/en/latest/. As the official said, Virtualenv is a tool for creating a standalone python environment. The most basic problem to solve is the dependency and version of the library, as well as the indirect permissions (indirectly permisions, not quite clear).
Although the official description is not too clear, I am still a Python rookie. But in short through it can solve python2 and python3 two environments do not interfere with each other. That's what I did:
First, install VIRTUALENV, the PIP on the default Python2 line:
1 |
$ [sudo] pip install virtualenv |
To create a virtual environment:
1 |
$ virtualenv - p / usr / bin / python3 py3env |
To activate a virtual environment:
1 |
$ source py3env / bin / activate |
You will notice that the shell prompts lines before (py3env), so you can safely use Python3 to do the development. Download a three-party library first try it:
It's done!
If you want to exit the Python3 virtual environment, enter the command
Can.
from:http://my.oschina.net/xiaoiaozi/blog/129769
Using virtualenv to build a Python 3 development environment on Ubuntu