We're kicking off some new projects using Python 3 (yay!) but had some issues getting virtualenvs working. Which is kinda ironic given that Python 3.3 included virtualenv in it, as pyvenv. Unfortunately, pyvenv isn't quite the same thing as virtualenv, and in particular it doesn't install/include pip and setuptools. There's also some additional issues introduced under Ubuntu.
First, you'll need to obtain Python 3.3. Some of the methods you could use will work and some are known to produce a non-viable environment. In particular:
- OS X: get it from homebrew ("brew install python3"). I've not tried other avenues, but this works and is the easiest approach in my opinion.
- Ubuntu: get it from source, building like so:
sudo apt-get install build-essential libsqlite-dev sqlite3 bzip2 libbz2-dev wget http://python.org/ftp/python/3.3.3/Python-3.3.3.tar.bz2 tar jxf ./Python-3.3.3.tar.bz2 cd ./Python-3.3.3 ./configure --prefix=/opt/python3.3 make && sudo make installDo not attempt to use any currently-available pre-built packages (eg. from a PPA) as they will create broken virtualenvs. See this discussion for some enlightenment, but note the lack of a reasonable solution.
- Windows: no idea, sorry.
Now that you've got a Python 3.3 installation, you can create your virtual environment. You do this with this command combination:
pyvenv-3.3 . /bin/activate wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py python3.3 ez_setup.py wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py python3.3 get-pip.py
Now you should have a viable, working Python 3.3 virtual environment.
Also, pip 1.5.1's "get-pip.py" will let you skip that extra setuptools install above when it's out (real soon).