2

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?

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560

1 Answers1

3

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"))
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • py3 code example was given here as a pseudocode, I believe. so for ppl's convenience here's the exact command which worked for me: `exec(compile(source=open('/Users/juggernaut/.pythonrc.py').read(), filename=".pythonrc.py", mode="exec"))` – juggernaut May 19 '22 at 09:39
  • @juggernaut thx for that input - i'm updating the answer with your correct code – WestCoastProjects May 19 '22 at 16:31
  • In python 3, I add the line `import os; exec(open(os.environ["PYTHONSTARTUP"]).read())` to the Python Console Starting script. – kadee Aug 22 '22 at 09:39