Mac使用brew安裝Python時報錯:Error: The following directories are not writable by your user:

今天在使用brew安裝Python的時候出現這個錯誤,翻譯過來大概意思是“你當前用戶沒有下列目錄的寫權限”
如下
在這裏插入圖片描述

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文件夾的權限,
可是,這兩個文件夾我當前用戶都有寫權限
在這裏插入圖片描述

但還是抱着試一試的心態照着做了,可是,該報錯還是報錯
如下例(爲了避免一些不必要的麻煩就對一些內容隱藏)
在這裏插入圖片描述
照着做了後,也無法安裝,然後仔細看報錯信息,

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,成功
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章