代码之家  ›  专栏  ›  技术社区  ›  swiss_knight

sudo-H pip install与pip的区别——用户安装

  •  -1
  • swiss_knight  · 技术社区  · 7 年前

    我想知道这两个命令有什么区别(我觉得它们是一样的):

    • sudo -H pip install <package>
    • pip --user install <package>



    从sudo手册页:

    -H, --set-home
        Request that the security policy set the HOME environment
        variable to the home directory specified by the target user's
        password database entry. Depending on the policy, this may be
        the default behavior.
    

    https://pip.pypa.io/en/stable/user_guide/


    相关问题:
    What is the difference between pip install and sudo pip install?
    What is the purpose "pip install --user ..."?
    sudo pip install VS pip install --user

    1 回复  |  直到 7 年前
        1
  •  0
  •   notjoshno Deathsidious    7 年前

    sudo是superuser do的缩写。它只是以根用户权限运行命令,如果您安装到一个通常无法访问的目录中,这可能很有用。

    但是,在您给出的示例中,这两个命令的功能是相同的,因为您不需要根权限 pip install --user