In your ~/.bashrc
:
export PYTHONSTARTUP=$HOME/.pythonstartup
and put your python code in $HOME/.pythonstartup
, like:
import rlcompleter
import readline
readline.parse_and_bind("tab: complete")
Then run the interactive shell:
python
See the imports from PYTHONSTARTUP are processed. This only works in python interactive mode.
For more information about PYTHONSTARTUP
variable, read the python man page:
$ man python
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…