Search code examples
pythonmacosnumpypython-module

How to Install third-party libs to Python 3.X when two other 2.Xs are also on MacOs?


I have Python2.6, 2.7 and 3.4 on my Mac. Yesterday I was trying to install Numpy to Python3.4, then I realized I don't really know how to install third-party libs(or modules) on MacOS, but I had some experience on Win8 before, so I tried and typed pip3 install numpy in terminal, and it worked! But here comes my questions-what if I typed pip install numpy, will it go straight to 2.6 or 2.7, or both? (Well, since Numpy is already there for both 2.Xs, I didn't test it on my own.) And is this pip the only way to specialize the installations? What else? Besides, is there also a lib or libs directory under Python on MacOS? Where can I find them to check whether some modules are already there or not?


Solution

  • See pip: dealing with multiple Python versions?

    But especially look at the second answer (not the accepted one).

    If you download the source for pip, you can then install it using different python versions (via easy_install) and it will give you versioned copies of pip that know where to install other packages.

    That gets you bootstrapped, and then you can pip3.4 install -U pip to keep it up to date.

    Oh, I do wish homebrew would bring back the recipes for different python versions.