Mac使用brew安装Python时报错:Error: The following directories are not writable by your user:

今天在使用brew安装Python的时候出现这个错误,翻译过来大概意思是“你当前用户没有下列目录的写权限”
如下
Mac使用brew安装Python时报错:Error: The following directories are not writable by your user:_第1张图片

Error: The following directories are not writable by your user:
/usr/local/lib/python3.7/site-packages

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/lib/python3.7/site-packages

And make sure that your user has write permission.
  chmod u+w /usr/local/lib/python3.7/site-packages

然后在网上百度,看到好多都是修改/usr/local/bin和/usr/local/share文件夹的权限,
可是,这两个文件夹我当前用户都有写权限
Mac使用brew安装Python时报错:Error: The following directories are not writable by your user:_第2张图片

但还是抱着试一试的心态照着做了,可是,该报错还是报错
如下例(为了避免一些不必要的麻烦就对一些内容隐藏)
Mac使用brew安装Python时报错:Error: The following directories are not writable by your user:_第3张图片
照着做了后,也无法安装,然后仔细看报错信息,

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/lib/python3.7/site-packages

And make sure that your user has write permission.
  chmod u+w /usr/local/lib/python3.7/site-packages

You should change the ownership of these directories to your user.
你应该修改这些目录的所有权为你当前用户
And make sure that your user has write permission.
并且确保你当前用户具有写权限

写的明明白白,并且还附上修改语句,为什么不仔细看错误提示?为什么?为什么?为什么?(这里要加粗警示)

然后直接使用给的两条语句,修改/usr/local/lib/python3.7/site-packages的所有权和权限,安装Python,成功
Mac使用brew安装Python时报错:Error: The following directories are not writable by your user:_第4张图片

你可能感兴趣的:(Mac使用指南,Python)