Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 452
YXD Avatar asked Feb 02 '12 12:02

YXD


People also ask

Why import numpy as NP is not working?

Python import numpy is not working that means eithers the module is not installed or the module is corrupted. To fix the corrupted module, uninstall it first then reinstall it.

How do you check numpy is installed or not?

Go to Python -> site-packages folder. There you should be able to find numpy and the numpy distribution info folder. If any of the above is true then you installed numpy successfully.


1 Answers

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.

like image 78
supakeen Avatar answered Sep 22 '22 21:09

supakeen