【问题标题】:Homebrew , python installing自制,python安装
【发布时间】:2012-10-16 20:11:38
【问题描述】:

我在尝试通过自制软件安装 python 时出错。 brew 说它无法链接 python ,这里是输出:

Linking /usr/local/Cellar/python/2.7.3... Warning: Could not link python. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/python/2.7.3/bin/smtpd2.py
/usr/local/bin/smtpd2.py may already exist.
/usr/local/bin may not be writable.

ls -la on /usr/bin 和 bin 权限:

The drwxrwxrwx  26 root             admin  884 26 Oct 16:03 bin

而且 smtpd2.py 是存在的。我该如何解决?删除 smtpd2.py ?

【问题讨论】:

  • 你/可以/sudo rm -rf smtpd2。但这里有一个更大的问题:为什么要使用 homebrew 来安装 python?为什么不直接从python downloads page 下载呢?
  • 我不仅会通过 homebrew 安装 python。只想使用自制软件而不是 macports 作为主包管理器。
  • brew install python --universal --framework,我是用这个命令安装的。
  • 是的,我按照你说的安装了它,但在安装结束时出现错误。

标签: python macos osx-snow-leopard homebrew


【解决方案1】:

听起来像是 /usr/local 的权限问题。

### Makes you owner of /usr/local 
$ sudo chown -R `whoami` /usr/local

### Force uninstalls failed python
$ brew uninstall -f python

### Clear the brew cache
$ rm -rf `brew --cache`

### Recreate the brew cache
$ mkdir `brew --cache`

### Cleanup - cleans up old homebrew files
$ brew cleanup

### Prune - removes dead symlinks in homebrew
$ brew prune

### Doctor - runs homebrew checks for common error causing issues
$ brew doctor

########
### Google and follow steps to fix what `brew doctor` came back with
########

### Reinstall python
$ brew install python

【讨论】:

  • 谢谢,这有助于通过自制软件安装python:)
  • 我在 brew doctor 得到这个 - 你能帮忙吗?警告:python 符号链接到 python
  • 尝试按照上述方法,但在卸载和缓存清除行之间运行rm -rf /usr/local/Cellar/python
  • 如果是权限问题,修复/usr/local后也可以直接运行brew link pythonbrew link --overwrite python。使用brew link --dry-run --overwrite python 会告诉你如果不这样做会发生什么变化。
  • 谢谢,brew prune 解决了我的问题!
【解决方案2】:

你试过brew link --overwrite python吗?这对我有用,而无需卸载 python - 有关更多详细信息,请参阅 this question

【讨论】:

  • 我必须像接受的答案那样 chown /usr/local,然后这个命令运行良好。
  • 新命令是 brew linkapps python 符号链接到应用程序
猜你喜欢
  • 1970-01-01
  • 2016-02-14
  • 2020-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-18
相关资源
最近更新 更多