pythonnumpybpython

bpython configuration - importing numpy and matplotlib by default


Is it possible to start the bpython interpreter so that it always runs some custom commands when it launches?

In my case I simply want to do:

import numpy as np
import matplotlib.pyplot as plt

I can't see anything in the docs. Anyone know a way?


Solution

  • It is written in the docs, just not clearly labelled as such at: http://docs.bpython-interpreter.org/django.html

    Gist of it is you can have an environment variable called PYTHONSTARTUP. bpython will execute this file before you get dropped in the interpreter.