pip的-H标志是什么?

2024-05-20 22:59:49 发布

您现在位置:Python中文网/ 问答频道 /正文

在pip版本6.0.4或更高版本中使用sudo pip install ...时,我会收到一些警告,如:

The directory '/home/drevicko/.cache/pip/log' 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.

此警告似乎是added in 6.0.4,但-H标记既不出现在^{} docs中,也不出现在pip's general options上的文档中。

那么,什么是-H标志,为什么在使用sudo pip install ...时需要它?


Tags: installpiporandthe版本log警告
1条回答
网友
1楼 · 发布于 2024-05-20 22:59:49

-H标志实际上是用于sudo命令的,而不是用于pip。取自docs

The -H (HOME) option requests that the security policy set the HOME environment variable to the home directory of the target user (root by default) as specified by the password database. Depending on the policy, this may be the default behavior.

看一看this问题可能会对可能发生的事情有更多的了解。

相关问题 更多 >