![]() | 1 dreampuf 2014-08-13 11:58:09 +08:00 - 尽量避开重名模块 - 从项目路径导入 from YOURAPP import test - 改变 sys.path 顺序 |
![]() | 2 Zuckonit 2014-08-13 12:28:01 +08:00 名字没取好 可以加上路径 |
![]() | 3 pyKun 2014-08-13 12:48:49 +08:00 以后不要取这种命 除了一楼的方法还有 import ..test 类的写法 |
4 timonwong 2014-08-13 12:56:20 +08:00 ![]() 还有更猥琐的方法 import imp mod = imp.load_source(module_name, fullpath) |
5 datou552211 OP |
![]() | 6 dreampuf 2014-08-13 15:18:06 +08:00 @datou552211 print(module.__file__) 事半功倍 |