>>> sys.path ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-aarch64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0'] >>> sys.path.insert(0,/home/nvidia/) File "<stdin>", line 1 sys.path.insert(0,/home/nvidia/) ^ SyntaxError: invalid syntax >>> sys.path.insert(0,'/home/nvidia/') >>> sys.path ['/home/nvidia/', '', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-aarch64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0'] >>> sys.path.insert(1,'/home/nvidia/') >>> sys.path ['/home/nvidia/', '/home/nvidia/', '', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-aarch64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0'] >>>
由于sys.path是全局搜索路列表list,list具有insert方法,原型是insert(i, x)
i表示位置
x表示数据
意思是把数据x插入到位置i中