'pip install< package>'一致的权限被拒绝 [英] 'pip install <package>' consistent permission denied

查看:170
本文介绍了'pip install< package>'一致的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始构建新的Macbook Pro.我是管理员用户.如果我运行pip命令,我会不断收到诸如以下这样的权限被拒绝错误:

I just started building a new macbook pro. I'm an admin user. If I run a pip command I consistently get permission denied errors as such:

权限被拒绝:'/lib/python2.7/site-packages/'

Permission denied: '/lib/python2.7/site-packages/'

我跑步时

$ sudo pip install <package>

我收到此错误:

The directory '/Users/nate_argetsinger/Library/Logs/pip' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/Users/nate_argetsinger/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/Users/nate_argetsinger/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.

添加-H标志可消除该错误.

Adding the -H flag suppresses the error.

最后,我相信我是该错误消息所引用目录的用户:

Lastly, I believe I am the user who owns the directory the error message refers to:

➜  startbootstrap-agency git:(gh-pages) ✗ ls -l 

...

drwx------  3 nate_argetsinger  staff  102 Jan 14 03:29 c
drwx------  3 nate_argetsinger  staff  102 Jan 14 03:42 d
drwx------  5 nate_argetsinger  staff  170 Jan 14 03:29 f
➜  startbootstrap-agency git:(gh-pages) ✗ whoami
nate_argetsinger
➜  startbootstrap-agency git:(gh-pages) ✗

谢谢.

推荐答案

似乎您破坏了主目录上的权限,很可能是由于对(c0>的使用不当)造成的.

It seems you have corrupted the permissions on your home directory, most likely due to the (improper) use of sudo.

解决此问题的最佳方法是从磁盘工具"中运行修复磁盘权限"选项.

The best way to resolve this is to run "Repair Disk Permissions" option from Disk Utility.

这篇关于'pip install&lt; package&gt;'一致的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆