问题描述
我在macOS Mojave 10.14.2中运行了brew outdated
,并确定python
和python@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/[email protected]_2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring [email protected]_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 python
和brew 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!