停止PyCharm以root身份运行pip

时间:2017-11-25 09:03:26

标签: python pip pycharm virtualenv pip3

我需要在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

但是,如果我将提供密码并单击Authenticate然后pip,pip3和virtualenv将被破坏,因为IDE正在尝试以root身份安装Django。我怎样才能阻止PyCharm以root身份运行pip?

1 个答案:

答案 0 :(得分:1)

要使PyCharm在虚拟环境中发挥出色,请执行以下操作:

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