简体   繁体   中英

'pip install <package>' consistent permission denied

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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