Linux Python: 出现directory is not owned by the current user警告

编译源代码的方式安装,在最后执行sudo make install的时候,出现如下警告
The directory '/home/fkjava/.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.
The directory '/home/fkjava/.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.


出现这个警告的原因很简单:在用户目录下的~/.cache/pip/http和~/.cache/pip两个目录或者它的上级目录拥有者,不是root用户引起的。因为使用了sudo执行,所以其实这些缓存文件应该在root用户的Home目录里面的。
此时此刻,我们需要在sudo后面加上-H参数即可,就会在执行sudo的时候,把HOME变量的值改为root的Home目录。

最终执行命令为:sudo -H make install

来源:http://www.crazyit.org/forum.php?mod=viewthread&tid=12440

posted @ 2019-01-17 23:01  SpaceVision  阅读(502)  评论(0编辑  收藏  举报