无法在Mojave中酿造升级Python [英] Unable to brew upgrade Python in Mojave

查看:85
本文介绍了无法在Mojave中酿造升级Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在macOS Mojave 10.14.2中运行了brew outdated,并确定pythonpython@2已过时.当我运行brew upgrade时,两者都失败了.例如python@2:

I ran brew outdated in macOS Mojave 10.14.2 and determined that python and python@2 were outdated. When I ran brew upgrade it failed for both. For example for python@2:

==> Upgrading python@2 
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_2.mojave.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

我运行了brew doctor,它建议使用brew link,但这仍然失败,并出现相同的权限错误:

I ran brew doctor and it recommends to brew link but this still fails with the same permission error:

Linking /usr/local/Cellar/python@2/2.7.15_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

This post recommends to grant privileges to the parent directory, but I want to understand why this happens and find a solution for learning.

推荐答案

我找到了答案在这里.根据该帖子,我必须先sudo mkdir /usr/local/Frameworks创建丢失的目录,然后再创建sudo chown -R $(whoami) $(brew --prefix)/*,因为sudo chown -R $(whoami) /usr/local在Mojave和High Sierra中不再可用.之后我可以brew link pythonbrew link python@2.

I found the answer here. I had to sudo mkdir /usr/local/Frameworks to create the missing directory first, then sudo chown -R $(whoami) $(brew --prefix)/* since sudo chown -R $(whoami) /usr/local no longer works in Mojave - and High Sierra before that, according to the post. I was able to brew link python and brew link python@2 after that.

这篇关于无法在Mojave中酿造升级Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆