pythonubuntupython-3.xubuntu-12.04pip

How to install python3 version of package via pip on Ubuntu?


I have both python2.7 and python3.2 installed in Ubuntu 12.04.
The symbolic link python links to python2.7.

When I type:

sudo pip install package-name

It will default install python2 version of package-name.

Some package supports both python2 and python3.
How to install python3 version of package-name via pip?


Solution

  • You may want to build a virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)

    This could be something like:

    virtualenv -p /usr/bin/python3 py3env
    source py3env/bin/activate
    pip install package-name