【问题标题】:Stop PyCharm running pip as root停止以 root 身份运行 pip 的 PyCharm
【发布时间】:2018-05-09 02:48:08
【问题描述】:

我需要在 PyCharm 中创建 Django 项目。我正在使用解释器3.6.3 at /usr/bin/python3.6。创建后,我收到消息Authentication is needed to run /usr/bin/python3.6 as the superuser。我点击了取消,我得到了:

Executed command: pip install Django
Error occurred: Non-zero exit code (126)
Proposed solution:
   Try to run this command from the system terminal. Make sure that you use correct version of 'pip' installed for your Python interpreter located at '/usr/bin/python3.6'.
Command output:
   Error executing command as another user: Request dismissed

但是,如果我提供密码并单击身份验证,那么 pip、pip3 和 virtualenv 将被破坏,因为 IDE 正在尝试以 root 身份安装 Django。如何阻止 PyCharm 以 root 身份运行 pip?

【问题讨论】:

    标签: python pip pycharm virtualenv pip3


    【解决方案1】:

    要让 PyC​​harm 在虚拟环境中发挥出色,请执行以下操作:

    1 - 使用shell创建virtualenv

    • 创建虚拟环境:virtualenv <virtualEnvName>
    • 激活虚拟环境:. <virtualEnvName>/bin/activate
    • 下载包到虚拟环境:pip install <pkg>

    2 - 告诉 PyCharm 你创建的 virtualenv

    • 在 PyCharm 中打开项目File > Open > urProject
    • 从 virtualenv 中选择解释器PyCharm Community Edition > Preferences > Project > Project Interpreter

    【讨论】:

      猜你喜欢
      • 2021-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 2017-07-29
      • 2013-12-19
      • 2022-09-29
      • 2020-07-14
      相关资源
      最近更新 更多