Is there a difference between "brew install" and "pip install"?
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.
I am also kind of confused about the differences between pip
-installed vs. brew
-installed python packages.
My understanding is that pip-installed package is not compiled for your specific system. It fetches the package from the the Python Package Index then compile and build it in your computer. Python package installed via homebrew
is already built and compiled for your specific system (Macos). They should both work. But I am not sure whether packages installed from the two ways will be put in the same location.
For your questions about installing pillow
via homebrew
, I believe you should already done brew tap homebrew/python
, because that's how you can install python packages from homebrew
. On this github page they claim that
Formula are installed with
Python 2
support by default. For simultaneousPython 3
support, usebrew install <formula> --with-python3
. If you don't needPython 2.x
support at all, you can pass--with-python3
--without-python
.
So try
brew install pillow --with-python3
or
brew install pillow --with-python3 --without-python
if you only want to install pillow
for python3
. You may need to do brew uninstall pillow
first if homebrew
warns you that pillow
is already installed.
Homebrew is a package manager, similar to apt
on ubuntu or yum
on some other linux distros. Pip is also a package manager, but is specific to python packages. Homebrew can be used to install a variety of things such as databases like MySQL and mongodb or webservers like apache or nginx.
pip install pillow
should place the package in your PYTHONPATH whereas if you install it with brew, unless you've added the appropriate directories to your PYTHONPATH, python won't be able to import anything from it. If you're installing a python module, definitely use pip