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?
Asked
Active
Viewed 103 times
0

Jeff Liu
- 79
- 1
- 8
-
I suggest you look into `virtualenv`. You can also see what `python` refers to with `which python`. – jonrsharpe Mar 17 '15 at 13:48
-
@jonrsharpe I heard of it before when I was looking through some Flask files, it seems quite popular these days, do you use it a lot? – Jeff Liu Mar 17 '15 at 13:57
-
Yes, I find it's the easiest way to deal with having different requirements for different projects – jonrsharpe Mar 17 '15 at 14:01
1 Answers
1
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.
-
So that means if I want Numpy goes to python2.6, I can just type pip2.6, and pip2.7 for python2.7, I got it! – Jeff Liu Mar 17 '15 at 14:13
-
Yes. But for serious python work (especially on OSX) you **really** need to use `virtualenv` – kdopen Mar 17 '15 at 14:16