protected static void initEnvironment(
      Project project, GeneralCommandLine commandLine, PythonRunParams myConfig) {
    Map<String, String> env = myConfig.getEnvs();
    if (env == null) {
      env = new HashMap<String, String>();
    } else {
      env = new HashMap<String, String>(env);
    }

    setupEncodingEnvs(env, commandLine.getCharset());

    addCommonEnvironmentVariables(env);

    commandLine.getEnvironment().clear();
    commandLine.getEnvironment().putAll(env);
    commandLine.withParentEnvironmentType(
        myConfig.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);

    buildPythonPath(project, commandLine, myConfig);
  }