“brew install"和“brew install"之间有区别吗?和“pip安装"? [英] Is there a difference between "brew install" and "pip install"?
问题描述
我想在我的 Mac 上安装枕头.我有 python 2.7
和 python 3.4
,两者都安装了 Homebrew.我尝试了 brew install Pillow
并且效果很好,但仅适用于 python 2.7
.我还没有找到为 python 3
安装它的方法.我试过 brew installpillow3
但没有运气.我在 SO 上找到了一篇帖子,说首先用 Homebrew 安装 pip3
,然后使用 pip3 install Pillow
.碰巧的是,我已经安装了 pip3
.
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
.
我从来不明白使用 pip
安装 python 包和使用 Homebrew 安装它之间的区别(如果有的话).你能给我解释一下吗?另外,如果有可用的公式,是否最好与 Homebrew 一起安装?如果使用 Homebrew 安装确实更可取,您知道如何使用 Homebrew 为 python 3
安装 pillow
吗?
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?
第一个答案表明我没有把自己说清楚.如果我用 pip install Pillow
而不是 brew install Pillow
安装了枕头,我的系统上的安装会有什么不同吗?为什么 Homebrew 会制作一个公式来执行 pip
已经做到的事情?它会检查额外的先决条件还是什么?为什么有 python2
的枕头公式,但我不能告诉 python3
的 pillow
公式?
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
?
推荐答案
好吧,OSX 的包可能包括 Python 的包.
well, packages for OSX may include packages for python.
pip
是 Python 世界的打包器——你应该只能用它来安装 Python 的东西;homebrew
是一个针对 OSX 的包管理器;它不会对您可以使用它安装的软件强加任何限制 - 因为 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.
使用 brew
安装东西会将它们安装到 /usr/local/
;
installing things with brew
will install them into /usr/local/
;
使用 pip
安装东西将从 Python 包索引中获取包,并且它将把它们安装在你的 python 解释器可以找到它们的地方:要么在你的主目录中(例如 ~/.local/lib/python2.7/site-packages/
)或在一些全局搜索中-你的python解释器的路径(例如/usr/local/lib/python2.7/dist-packages/
)
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/
)
如果你已经通过 brew
安装了 python
解释器,那么任何通过 brew
安装的 python 包都可以使用的可能性很高盒子里的.
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.
这篇关于“brew install"和“brew install"之间有区别吗?和“pip安装"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!