import sys default_path = r'C:\Users\lon\Desktop' #自定义路径 sys.path.append(default_path) #将自定义路径加到sys模块path路径中 print(sys.path) from test1 import Demo d = Demo() print(d.Hi())