Update: If you’re already using Python >=3.3 then there’s is already a package called venv which you can use to create you’re virtual environment with just:
python3 -m venv myennv
virtualenv is very useful in developing Python because you can create your project’s own environment without polluting the or messing with the global or your other projects Python environment.
First make sure that you have already installed virtualenv and pip for Python 3.
$ sudo apt-get install python3-pip $ sudo pip3 install virtualenv
After installing both pip and virtualenv for Python 3 you can now create a virtualenv by entering this:
$ virtualenv --no-site-packages --distribute -p /usr/bin/python3 env
$ python3 -m virtualenv env
The “env” at the last part is where virtualenv will create the Python 3 environment.
To make sure that we really have created a Python 3 environment. Activate the virtualenv and check the Python version.
$ source env/bin/activate $ python --version Python 3.4.0 $
As you can see at line 4 mine is already setup and is using Python 3.4.0.
Leave a Reply