我想其他人会事先提出这个问题,但我找不到。 我的问题是,我的发言载于我的<编码>。
ip.ex( import matplotlib as mat )
ip.ex( import matplotlib.pyplot as plt )
ip.ex( import numpy as np )
ip.ex( import pupynere as pu )
ip.ex( import g )
ip.ex( import bsite )
ip.ex( import csvf )
ip.ex( import pandas as pa )
ip.ex( import pickle as pk )
ip.ex( import mathex as mathex )
ip.ex( import os as os )
ip.ex( import re as re )
ip.ex( import scipy as sp )
ip.ex( import mpl_toolkits.basemap as bmp )
ip.ex( from mpl_toolkits.basemap import cm )
之后 如果我使用Python牌照,这些模块将在我开始排队时直接装上,但如果我有纸面文字,例如,ba_plot.py
用于做一些地块。 我用互动的方式在柏顿打上了这本书,但当时我想把它放在空壳站内,例如:
chaoyue@chaoyue-Aspire-4750:~$ python ba_plot.py
but before this, each time I need to copy at the beginning of ba_plot.py
file the following again:
import matplotlib as mat
import matplotlib.pyplot as plt
import numpy as np
import pupynere as pu
import g
import bsite
import csvf
import pandas as pa
import pickle as pk
import mathex as mathex
import os as os
import re as re
import scipy as sp
import mpl_toolkits.basemap as bmp
from mpl_toolkits.basemap import cm
Because otherwise it will complain it cannot find the module. So, is there anyway that I can avoid do this by including some header file at the beginning of my python script while in the header file all these modules are imported? By this way, I need only to add on line at the beginning of my python script.