Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
164 views
in Technique[技术] by (71.8m points)

python - Is there a difference between "brew install" and "pip install"?

I want to install pillow on my Mac. I have python 2.7 and python 3.4, both installed with Homebrew. I tried brew install pillow and it worked fine, but only for python 2.7. I haven't been able to find a way to install it for python 3. I tried brew install pillow3 but no luck. I've found a post on SO that says to first install pip3 with Homebrew and then use pip3 install pillow. As it happens, I have already installed pip3.

I've never understood the difference, if any, between installing a python package with pip and installing it with Homebrew. Can you explain it to me? Also, is it preferable to install with Homebrew if a formula is available? If installing with Homebrew is indeed preferable, do you know how to install pillow for python 3 with Homebrew?

The first answers indicate that I haven't made myself plain. If I had installed pillow with pip install pillow instead of brew install pillow would the installation on my system be any different? Why would Homebrew make a formula that does something that pip already does? Would it check for additional prerequisites or something? Why is there a formula for pillow with python2, but not as far as I can tell for pillow with python3?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

well, packages for OSX may include packages for python.

pip is a packager for the python world - you should only ever be able to install python-things with it; homebrew is a package manager targetted at OSX; it doesn't impose any restrictions onto what software you can install with it - since python is a subset of software.

installing things with brew will install them into /usr/local/;

installing things with pip will fetch packages from the Python Package Index, and it will install them in a place where your python interpreter will find them: either into your home directory (e.g. ~/.local/lib/python2.7/site-packages/) or in some global search-path of your python interpreter (e.g. /usr/local/lib/python2.7/dist-packages/)

if you have installed the python interpreter via brew, then chances are high that any python-package installed via brew will be usable out of the box.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...