Search code examples
pythonpython-3.xpython-2.7pip

How to use pip with Python 3.x alongside Python 2.x


I installed Python 3.x (besides Python 2.x on Ubuntu) and slowly started to pair modules I use in Python 2.x.

So I wonder, what approach should I take to make my life easy by using pip for both Python 2.x and Python 3.x?


Solution

  • The approach you should take is to install pip for Python 3.2.

    You do this in the following way:

    $ curl -O https://bootstrap.pypa.io/get-pip.py
    $ sudo python3.2 get-pip.py
    

    Then, you can install things for Python 3.2 with pip-3.2, and install things for Python 2-7 with pip-2.7. The pip command will end up pointing to one of these, but I'm not sure which, so you will have to check.