dimanche 31 mars 2013

python 3.3 pyvenv distribute pip hackish fix

Python3.3 includes an official virtualenv helper called pyvenv. Small detail though, it's not a swap-in replacement, you need to install distribute and pip by hand (at least for now) as said in the documentation. See the Note paragraph here http://docs.python.org/dev/library/venv.html#creating-virtual-environments.

Warning: you need to re-source the venv after `easy_install pip` !
Here's a complete session:

dummy@x60s_GPT ~/dev/python3.pyvenv % pyvenv venv

dummy@x60s_GPT ~/dev/python3.pyvenv % source venv/bin

(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % curl -O http://python-distribute.org/distribute_setup.py && \python distribute_setup.py && easy_install pip

# At that point, pip won't work, re-source venv/bin/activate

(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % source venv/bin/activate


# From now on pip will work


dummy@x60s_GPT ~/dev/python3.pyvenv % pip install requests

Downloading/unpacking requests
  Running setup.py egg_info for package requests
   
Installing collected packages: requests
  Running setup.py install for requests
   
Successfully installed requests
Cleaning up...
(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % echo $?

0

Aucun commentaire:

Enregistrer un commentaire