The directory '*' or its parent directory is not owned by the current user

使用sudo pip install …的时候出现下面一段warning:

WARNING: The directory '/home/alex/.cache/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 sudo's -H flag.
WARNING: The directory '/home/alex/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

翻译一下就是:
当前用户不拥有目录“ /home/stone/.cache/pip/http”或其父目录,并且缓存已被禁用。 请检查该目录的权限和所有者。 如果使用sudo执行pip,则可能需要sudo的-H标志。 目录’/home/stone/.cache/pip’或它的父目录不属于当前用户,并且缓存轮已被禁用。 检查该目录的权限和所有者。 如果使用sudo执行pip,则可能需要sudo的-H标志。

解决方案: 在sudo 后面添加-H

sudo -H pip install ......
发布了636 篇原创文章 · 获赞 147 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/weixin_43336281/article/details/102598284