简体   繁体   English

mac os pip3 安装权限错误。 检查权限

[英]mac os pip3 install permision error. Check the permissions

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Users/user/Library/Python/3.8/lib'
Check the permissions.

I use pip3 install --user --upgrade tensorflow .我使用pip3 install --user --upgrade tensorflow

Why Is't work... Somebody help me pls..为什么不工作...有人帮助我..

I probably meet the same problem.我可能遇到同样的问题。

pip3 install lxml

Result:结果:

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.

Mostly of answers tell us to add --user大多数答案告诉我们添加 --user

pip3 install lxml --user

Result:结果:

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.

I don't want to use sudo to install package我不想使用sudo来安装 package

sudo pip3 install lxml

I can't install then use virtualenv我无法安装然后使用virtualenv

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

I found only Python on path '/Users/username/Library/' be owned by root,我在路径 '/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
...

I decided to use chown , problem solved.我决定使用chown ,问题解决了。

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

I had no idea what time dose Python folder be owned by root.我不知道什么时候 Python 文件夹归 root 所有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM