
1 dreampuf 2014 年 8 月 13 日 - 尽量避开重名模块 - 从项目路径导入 from YOURAPP import test - 改变 sys.path 顺序 |
2 Zuckonit 2014 年 8 月 13 日 名字没取好 可以加上路径 |
3 pyKun 2014 年 8 月 13 日 以后不要取这种命 除了一楼的方法还有 import ..test 类的写法 |
4 timonwong 2014 年 8 月 13 日 还有更猥琐的方法 import imp mod = imp.load_source(module_name, fullpath) |
5 datou552211 OP |
6 dreampuf 2014 年 8 月 13 日 @datou552211 print(module.__file__) 事半功倍 |