Search code examples
pythonintellij-ideapycharmstartupscript

How to set PYTHONSTARTUP script for Intellij/PyCharm


I tried adding the PYTHONSTARTUP environment variable:

enter image description here

I also tried a custom starting script:

enter image description here

But even more surprisingly - this also did not work (the npa alias was not recognized):

enter image description here

Out of a bit of desperation I even tried adding to the interpreter options:

enter image description here

That did nothing: (what actually is Interpreter options supposed to do .. ? )

Finally I also looked at the SDK settings for python - and also nothing available there:

enter image description here

So then how do we set the PYTHONSTARTUP script?


Solution

  • It's looking pretty unlikely that Intellij has any way to do this. Instead I have added the following to the beginning of the script

    execfile('/Users/boescst/.pythonstartup')
    

    That is for python2 . For python3 it is bit different - along the lines of

       exec(compile(source=open('/Users/juggernaut/.pythonrc.py')
           .read(), filename=".pythonrc.py", mode="exec"))