【问题标题】:'pip install <package>' consistent permission denied'pip install <package>' 一致的权限被拒绝
【发布时间】:2015-03-12 09:32:01
【问题描述】:

我刚刚开始构建新的 macbook pro。我是管理员用户。如果我运行 pip 命令,我始终会收到权限被拒绝错误,例如:

权限被拒绝:'/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 标志会抑制错误。

最后,我相信我是拥有错误消息所指目录的用户:

➜  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) ✗

提前致谢。

【问题讨论】:

  • 很高兴您解决了您遇到的问题。你有什么问题?

标签: python permissions pip sudo


【解决方案1】:

您似乎损坏了主目录的权限,很可能是由于(不当)使用了sudo

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-12
    • 2011-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    相关资源
    最近更新 更多