How to create a virtualenv with Python3.3 in Ubuntu?
Solution 1:
Python 3.3 has venv built-in.
http://docs.python.org/3/library/venv.html#module-venv
Simply run
pyvenv-3.3 /path/to/environment
And then to activate it
source /path/to/environment/bin/activate
This built-in version of virtualenv is much more flexible than what you're probably used to. For example, you can extend EnvBuilder to do pretty much whatever you want. You can copy an example implementation of EnvBuilder from the link below and play around with it: http://docs.python.org/3/library/venv.html#an-example-of-extending-envbuilder
That script above likely does most of what we expect to get out of virtualenv. So if you just need a virtualenv with easy_install and pip, you should be good to go.
See @MarkOfSine's edits below for clarification on how to get running if you're still confused.
To add to the above, and as per docs:
For example, after executing: pyvenv-3.3 /path/to/my_project/venv
You can run distribute_setup.py
, which seems to do various things, but essentially you end up with easy_install
in your ./my_project/venv/bin
directory.
This can then be used to install pip
and the like.
It does not say where you should get distribute_setup.py
from, so I downloaded from:
http://python-distribute.org/distribute_setup.py
and using the activated environment:
cd /path/to/my_project
source venv/bin/activate
ran :
python distribute_setup.py
and
easy_install pip
Which then completed the setup of the virtual environment more inline with virtualenv on python 2.x
Solution 2:
It is easier than as it seems:
virtualenv -p /usr/bin/python3 yourenv
source yourenv/bin/activate
pip install package-name
really works :)