Python - Startup script for the console ($PYTHONSTARTUP)

1 - About

The environment variable named $PYTHONSTARTUP points the name of a file containing your start-up commands.

This file is only read in interactive sessions, not from a script.

If you want to read an additional start-up file from the current directory, you can program this in the global start-up file, e.g. “execfile('.pythonrc')”.

If you want to use the startup file in a script, you must do this explicitly in the script:

import os
if os.path.isfile(os.environ['PYTHONSTARTUP']):
    # python 2
    # python 3

3 - Documentation / Reference

For more information about PYTHONSTARTUP variable, read the python man page:

$ man python

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap