【问题标题】:mac os pip3 install permision error. Check the permissionsmacos pip3 安装权限错误。检查权限
【发布时间】:2021-07-24 19:51:06
【问题描述】:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/user/Library/Python/3.8/lib'
Check the permissions.

我使用 pip3 install --user --upgrade tensorflow

为什么不起作用...请有人帮助我..

【问题讨论】:

标签: python python-3.x tensorflow pip


【解决方案1】:

我可能遇到了同样的问题。

pip3 install lxml

结果:

Defaulting to user installation because normal site-packages is not writeable
Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB)
Installing collected packages: lxml
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/username/Library/Python/3.8'
Check the permissions.

大多数答案告诉我们添加--user

pip3 install lxml --user

结果:

Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB)
Installing collected packages: lxml
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/username/Library/Python/3.8'
Check the permissions.

我不想使用 sudo 来安装包

sudo pip3 install lxml

我不能安装然后使用virtualenv

virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt

我发现路径 '/Users/username/Library/' 上只有 Python 归 root 所有,

...
drwxr-xr-x    5 username  staff    160  6 29  2015 PubSub
drwx------    3 root      staff     96  3  6  2019 Python
drwxr-xr-x@   4 username  staff    128 10 21  2020 Reminders
drwxr-xr-x   37 username  staff   1184  8 19 23:03 Safari
drwxr-xr-x@   2 username  staff     64  3 12  2018 SafariSafeBrowsing
...

我决定使用chown,问题解决了。

sudo chown -R $USER  /Users/username/Library/Python

我不知道什么时候 Python 文件夹归根用户所有。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-28
    • 2021-01-28
    • 2015-01-16
    • 1970-01-01
    • 2021-06-21
    • 2016-02-06
    相关资源
    最近更新 更多