Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spyder default module import list

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.

like image 216
Tom Avatar asked Jan 18 '13 14:01

Tom


People also ask

How do I make Spyder default for .PY files?

Use the "Default Programs" interface and select the executable for your Spyder,try the "Set Associations" menu and use browse to select your executable. just need to be patient, to wait for a few seconds. Save this answer.

How do I reset my Spyder?

Q: How do I reset Spyder's preferences to the defaults? Either use the Reset Spyder to factory defaults under Tools in Spyder's menu bar, the Reset Spyder settings Start menu shortcut (Windows), or run spyder --reset in your system terminal (Anaconda prompt on Windows).


2 Answers

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.

like image 124
Carlos Cordoba Avatar answered Oct 24 '22 05:10

Carlos Cordoba


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.

like image 2
Tom Avatar answered Oct 24 '22 05:10

Tom