小编典典

自制程序,python安装

python

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

在/ usr / bin和bin权限上使用ls -la:

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

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


阅读 183

收藏
2021-01-20

共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
2021-01-20