Update for @Caleb answer for Python 3.5 on Ubuntu 14.04: I made this answer myself by copying the corresponding parts of @Caleb answer.
You can use ipython profiles to define startup scripts that will run each time ipython starts. A full description of the profiles is given here . You can create multiple profiles with different startup files.
Assuming you only need one profile, and you always need to have the same startup files every time you start ipython, you can simply change the default profile. To do this, first find out where your ipython configuration directory is located in the ipython session .:
Input:
import IPython ipython_config_dir = IPython.paths.get_ipython_dir() print(ipython_cofig_dir)
Output:
/home/johndoe/.ipython
In this example, johndoe is the username.
Inside the /.ipython folder, the /.ipython file is located in the profile_default subdirectory. Put any startup scripts in profile_default / startup. In the example here, the full path will be
/home/johndoe/.ipython/profile_default/startup
Thej Kiran May 23 '16 at 8:23 a.m. 2016-05-23 08:23
source share