Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to install the Pillow module for python 3.3, but for that I need to install pip. Every time that I install pip it installs for python 2.7, any help?

share|improve this question

4 Answers 4

up vote 9 down vote accepted

While on more modern versions of Ubuntu you could just sudo apt-get install python3-pip (and then use pip3), a Python 3 copy of pip was never packaged for 12.04.

Therefore you need to follow the more old fashioned install route with easy_install:

sudo apt-get install python3-setuptools
sudo easy_install3 pip

Now, there is every chance that this will clash with Python 2's pip and overwrite /usr/bin/pip. Instead of risking that, it's probably best to start investigating the happy world of virtualenv as this answer suggests.

share|improve this answer
    
I have already tried that but this always shows up: Unable to locate package python3-pip –  BCasaleiro Jan 28 at 19:38
    
@BCasaleiro Sorry, I should have checked. Updating the answer. –  Oli Jan 29 at 8:38
    
Thanks, it worked like a charm –  BCasaleiro Jan 29 at 11:06

If you work with several versions of python on the same machine, it might be useful to work with virtual environments. This allows you to work with as many instances of python you want, each with their own set of packages. This is very useful if you're working with several versions of python, and/or if your projects require different versions of the same package(s).

To set this up:

sudo pip install virtualenv 

This can be done with ANY pip, so also with the standard pip using python 2.7. Then, to make a virtual environment with python3 as the interpreter, do:

virtualenv my_py3 --python=/usr/bin/python3
source my_py3/bin/activate # to activate the python3 environemt

Then install any packages you might want using

pip install <package> # no sudo required now, as you're IN the virtual environment

To stop the virtual environment, simple type:

deactivate
share|improve this answer

After installing python 3.3 using a PPA for Ubuntu 12.04, I installed easy_install 3.3 using locally using the following commands

wget http://python-distribute.org/distribute_setup.py
python3.3 -m distribute_setup install --user
easy_install-3.3 --user pip

This avoids polluting the site's installation of pip and easy_install. Finally, I added $HOME/.local/bin to my path. Now I can run pip3.3!

share|improve this answer

You may also install it by sudo apt-get install python3-pip and then call it by pip3. Et voilà

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.