Scrapy - OS X Homebrew Python错误
我正在使用 OS X 版本 10.9.4。
我运行了 brew install python,但出现了以下错误……有人能告诉我发生了什么,以及我该怎么解决吗?
我在跟着这个教程:http://doc.scrapy.org/en/latest/intro/install.html(我最终是想下载 Scrapy。如果有人能提供一个比他们网站教程更详细的步骤,我会非常感激)
=> brew install python
==> Installing python dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.8.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-6.3.8.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.
OS X provides the BSD libedit library, which shadows libreadline.
er to prevent conflicts when programs look for libreadline we are
ting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
/usr/local/Cellar/readline/6.3.8: 40 files, 2.1M
==> Installing python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.8_1.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring python-2.7.8_1.mavericks.bottle.2.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
rm /usr/local/bin/2to3
To force the link and overwrite all conflicting files:
brew link --overwrite python
To list all files that would be deleted:
brew link --overwrite --dry-run python
Possible conflicting files are:
/usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3
/usr/local/bin/2to3-2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2
/usr/local/bin/2to3-2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2.7
/usr/local/bin/idle -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle
/usr/local/bin/idle2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2
/usr/local/bin/idle2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2.7
/usr/local/bin/pydoc -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc
/usr/local/bin/pydoc2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2
/usr/local/bin/pydoc2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
/usr/local/bin/python -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/usr/local/bin/python2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
/usr/local/bin/python2-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/usr/local/bin/python2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
/usr/local/bin/python2.7-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/usr/local/bin/pythonw -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw
/usr/local/bin/pythonw2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2
/usr/local/bin/pythonw2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
/usr/local/bin/smtpd.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd.py
/usr/local/bin/smtpd2.7.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.7.py
/usr/local/bin/smtpd2.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.py
==> /usr/local/Cellar/python/2.7.8_1/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.8_1/bin --install-lib=/usr/local/lib/python2.7/site-packa
==> /usr/local/Cellar/python/2.7.8_1/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.8_1/bin --install-lib=/usr/local/lib/python2.7/site-packa
==> Summary
/usr/local/Cellar/python/2.7.8_1: 4776 files, 76M
1 个回答
你的问题是,你已经在 /usr/local
安装了一个 Python 2.7(这个是在苹果预装的 /usr
里的 Python 2.7 之上)。最有可能的情况是,你是从 python.org 下载并运行了官方的安装程序。
因为 Homebrew 试图安装到 /usr/local
,而同一个地方不能有两个同名的东西,所以它不允许你这样做。
如果你真的需要在系统上有三个 Python 2.7,你就得为其中一个选择一个不同的位置。注意,现有的那个其实只是指向 /Library/Frameworks/Python.framework/Versions/2.7/
的一堆符号链接,而你想安装的新版本其实也是指向 /usr/local/Cellar/python/2.7.8
的一堆符号链接。所以,这些符号链接对任何一个来说其实都不是必须的。而且 Homebrew 让你不安装符号链接变得很简单:只要不执行 link
步骤就可以了。
当然,这意味着你不能直接用 pip
来为 Homebrew 的 Python 安装包,你得用 /usr/local/Cellar/python/2.7.8/bin/pip
。而且你也得用 /usr/local/Cellar/python/2.7.8/bin/python
来 使用 Homebrew 的 Python。
不用说,你可以把 cellar 目录添加到你的 PATH
中……但这会让你更加困惑。你很容易就会遇到,比如说,PATH
中第一个 pip
是来自 Homebrew cellar,而第一个 ipython
是来自 python.org 的安装,这样你安装的东西却找不到——更糟糕的是,你的 pip
和 python-config
不匹配,导致每次需要 C 编译器的安装都出错。
所有这些都引出了一个问题:你为什么需要三个 Python 2.7 的版本(至少有两个在你的 PATH
中),更不用说两个版本了。如果你知道自己在做什么,倒是可以让它正常工作……但显然在这里并不是这样。那么,为什么要给自己制造麻烦呢?