'pip install <package>' consistent permission denied

[亡魂溺海] 提交于 2019-12-12 01:51:24

问题


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:

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

When I run

$ sudo pip install <package>

I get this error:

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.

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

Thanks in advance.


回答1:


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.



来源:https://stackoverflow.com/questions/27938885/pip-install-package-consistent-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!