-1

I have a little issue with my Python dist packages. Here is a brief explanation.

I'm using Ubuntu 14.04 LTS, and have Python 2.7 and Python 3.4.0 installed on it. Furthermore, I have "pip" also.

For my work (project) I needed to install some additional packages, like:"NetworkX" and "Pony ORM".

The problem arose when I installed "pip" and then PonyORM.

As I can understand, when I got the pip it was installed directly to /usr/local/lib/python2.7/dist_packages folder.

This is because Python2.7 is a default version for Ubuntu?

I mean, for the case when I write python get-pip.py in the shell and not python3 get-pip.py.

So, my next decision was to install pip for Python3, in such a case it will (and it does) appear under: /usr/local/lib/python3.4/dist_packages folder.

Then I just installed "Pony ORM" one more time and now I have this package in both folders.

But when I decided to install NetworkX,it turned out that after installing pip for Python3, it works ONLY with Python3. So now, I have no idea how to overcome this issue, and install NetworkX in both "dist_package" folders.

What are possible solutions for situation? How can I deferentiate between pip installation?

Using python pip install something or python3 pip install something yields nothing.

Or maybe just create some independent folder and then update PATHs of both Pythons? But how?

Anyway, I will appreciate any help.

Thanks a lot in advance.

P.S. Please don't blame for English skills, it's still "under development" ^_^

2
  • Python2 and Python3 should be treated as two seperate entities. If you want to use both, then install any third party libraries in both of them. Also consider having a look at Python Virtual Environments docs.python-guide.org/en/latest/dev/virtualenvs
    – Carl H
    Mar 1, 2015 at 13:29
  • Thanks Carl, That is what I actually did, after writing this thread. Just need to get used to it.
    – bravoelf
    Mar 2, 2015 at 8:08

2 Answers 2

0

There should be a pip3 executable after installating pip into python3 that you can use to install into the python3 installation:

pip3 install something

I'm not 100% sure if that is the answer to your question, but maybe it helps.

0

To avoid any confusion between different versions of Python you can use the pip module from each python install.

So for Python2:

python -m pip install something 

And for Python3:

python3 -m pip install something

To make sure that python and python3 point to the desired python version you can check using:

which python
which python3

If the versions don't match or you have another python installed on your system then you can always use:

<path to python executable> -m pip install something

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .