Python3 virtual environments
I just went through the pain of installing a virtual environment for Python 3.3. Now before I forget what I did, I’m going to document the process here so I can find it again.
The first thing to note is that with Python 3.3 there is a built-in to create the virtualenv: pyvenv-3.3 You can run that with a directory to set up your virtual environment:
pyvenv-3.3 /path/to/env
Alternately, you can build the environment with a module command:
python3 -m venv /path/to/env
Unfortunately, the only thing that those commands do is to set up the file structure for the virtual environment. It doesn’t set up easy-install or pip or anything useful. So the next thing to do is to install python-distribute. You can pull that from http://python-distribute.org/, just grab the distribute_setup.py file. Once the file is downloaded, you’ll need to run it inside of your environment:
source /path/to/env/bin/activate python distribute_setup.py rehash
That will install easy-install and rehash your shell environment to point at it. From there, you can install pip and build any packages that you need:
easy_install pip pip install psycopg2 ...
(h/t to an answer on Ask Ubuntu for much of this information)
No trackbacks yet.