[CentralOH] Pypy and Virtualenv

iynaix iynaix at gmail.com
Sat Jun 15 21:55:47 CEST 2013


A question was brought up yesterday about how to use pypy with virtualenvs
at the DoJo yesterday, and I just wanted to provide a quick tip on how to
do that.

I'm assuming pypy has already been installed on your system. If it isn't,
there are some good instructions here: http://pypy.org/download.html

So after creating the directory that will house your project, set up a
virtualenv via:

virtualenv env -p `which pypy`

The crucial part is the latter portion of the command, which specifies
which python interpreter to use. After that, the virtualenv works as per
normal:

source env/bin/activate

Whenever you're in the virtualenv, pypy would become the default python
interpreter, i.e running 'python' or 'pypy' launches the pypy interpreter.
(the python command is just a symlink to pypy)

P.S: This works if you want to run python 3 within a virtualenv as well,
e.g: virtualenv env -p `which python3`
P.P.S: This is for UNIX-like systems only and won't work on windows.

Cheers,
XY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20130615/3ce424f6/attachment.html>


More information about the CentralOH mailing list