Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing pip3 with a virtualenv

I am trying to clean up a few things now that I have Mavericks. I used Homebrew to install python 2.7 and 3.3. I also have their respective pips. Now I want to have a sane virtualenv setup.

I see from virtualenv with python2 and python3 via Homebrew that I can specify which version of python a newly-created virtualenv will use. What is the best (i.e., easiest to use/remember) way to make sure that a virtualenv using Python 3.3 uses pip3?

ETA: I've not had to use 3.3 before, so this is my first experience trying to maintain different versions. Sorry if this has an obvious answer.

like image 341
verbsintransit Avatar asked Mar 22 '23 02:03

verbsintransit


1 Answers

Credit goes to scythargon for this one (left in a comment to Kristof's answer in this thread) and, since it did exactly what I needed, I figured it deserved its own answer.

When creating a virtualenv with virtualenvwrapper use the -p flag to explicitly associate it with a specific version of Python. In the examples below replace {virtualenv_name} with your intended virtual environment name:

Python 3.3:

$ mkvirtualenv {virtualenv_name} -ppython3.3

Python 3.4:

$ mkvirtualenv {virtualenv_name} -ppython3.4

Python 2.7:

$ mkvirtualenv {virtualenv_name} -ppython2.7
like image 160
respondcreate Avatar answered Mar 31 '23 21:03

respondcreate