How to set environment variables in PyCharm?

You can set environmental variables in Pycharm’s run configurations menu.

  1. Open the Run Configuration selector in the top-right and cick Edit Configurations...
  2. Find Environmental variables and click ...
  3. Add or change variables, then click OK

You can access your environmental variables with os.environ

import os
print(os.environ['SOME_VAR'])

Leave a Comment