How to create a virtual development environment by using virtualenv (say for python 3 on Ubuntu)
On Ubuntu 13.04, the default python is version 2.7. If you want to try out or really develop on top of python3, there would be lots of problems. Like for instance, when using pip to install packages, it is default to python2 packages.
In these situations, virtualenv could be a good choice.
In these situations, virtualenv could be a good choice.
You can find virtualenv on its official site http://www.virtualenv.org/en/latest/. As it is claimed , virtualenv is a tool for building independent python environment. The main goal of virtualenv is to solve the problems of dependence, version as well as indirectly permisions。
With virtualenv, your python2 would not interfere with python3 environment.
Step-by-step:
First, install virtualenv:
1 | $ [ sudo ] pip install virtualenv |
1 | $ virtualenv -p /usr/bin/python3 py3env |
activate this virtual environment:
source
py3env/bin/activate
Now, you have probably noticed that there is a "py3env".
Then, you can download some third part libs:
Then, you can download some third part libs:
1 | pip install httplib2 |
exit the python3 virtual environment
1 | $ deactivate |
that's it.
If you do not have root privilege, please refer to
If you do not have root privilege, please refer to
Post a Comment