Question

I'm trying to set up a slightly customised version of Spyder. When Spyder starts, it automatically imports a long list of modules, including things from matplotlib, numpy, scipy etc. Is there a way to add my own modules to that list?

In case it makes a difference, I'm using the Spyder configuration provided by the Python(X,Y) Windows installer.

Was it helpful?

Solution 2

The startup script for Spyder is in site-packages/spyderlib/scientific_startup.py.

Carlos' answer would also work, but this is what I was looking for.

OTHER TIPS

First you have to create a Python file with the modules you want to import at startup. Suppose you call it my_imports.py and that it has this contents:

import numpy as np
import matplotlib.pyplot as plt

Then you have to go to

Tools > Preferences > IPython Console > Startup > Run a file

select the option

Use the following file

and finally click on the button to the right of text field below that option to select your my_imports.py file.

If Spyder is executed as a python script by python binary, then you should be able to simply edit Spyder python sources and include the modules you need. You should take a look into how is it actually executed upon start.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top