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.
Why Is not work…谁来帮帮我……
我可能会遇到同样的问题。
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
只找到Python目录'/Users/username/Library/'为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文件夹何时归root所有。