thepandaatemyface
thepandaatemyface

Reputation: 5267

Automatically execute commands on launching python shell

I was wondering if there is a way to automatically run commands on entering the python shell as you would with the .bash_profile or .profile scripts with bash. I would like to automatically import some modules so I don't have to type the whole shebang everytime I hop into the shell.

Thanks,

Upvotes: 8

Views: 870

Answers (2)

colgur
colgur

Reputation: 180

Also consider using ipython if you're doing a lot of interactive work. Your options for this kind of automation expand significantly.

Upvotes: 1

Daniel DiPaolo
Daniel DiPaolo

Reputation: 56390

Yup you can use the PYTHONSTARTUP environment variable to do this as outlined here

Upvotes: 13

Related Questions