I think other may ask this before but I cannot find it. My question is, I have these statements in my .ipython/ipy_user_conf.py
:
ip.ex(\'import
You need to modify site.py. This script is run every time the Python program is run. For me, it lives in /usr/lib/python2.7/site.py
As Chris Morgan says, this is terribly bad practice and I strongly recommend you avoid it.
It's bad practice to have a script which depends on an external startup script to make it work. Doing these imports is how you should do it.
You could simplify it if you regularly import a fairly large set of things by centralising your imports in a file (call it common_imports.py
, for example), and then importing all from that (from common_imports import *
). That then becomes only one line to put in. I would still prefer to see explicit imports, however.
(Another note: in import os as os
, the as os
is entirely superfluous.)