30

尝试通过自制软件安装 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 ?

4

2 回答 2

84

听起来像是 /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
于 2012-10-26T14:47:51.990 回答
21

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

于 2013-03-04T06:15:19.540 回答