I find myself typing import numpy as np almost every single time I fire up the python interpreter. How do I set up the python or ipython interpreter so that numpy is automatically imported?
I find myself typing import numpy as np almost every single time I fire
Share
Use the environment variable PYTHONSTARTUP. From the official documentation:
So, just create a python script with the import statement and point the environment variable to it. Having said that, remember that ‘Explicit is always better than implicit’, so don’t rely on this behavior for production scripts.
For Ipython, see this tutorial on how to make a ipython_config file