
1 TankyWoo 2014-06-23 18:33:13 +08:00 tree pack pack ├── h │ ├── __init__.py │ └── out.py ├── __init__.py └── test.py 1 directory, 4 files python -m pack.h.out hello |
2 cj1324 2014-06-23 20:58:49 +08:00 不推荐相对导入。。 |
3 wynemo 2014-06-23 21:21:53 +08:00 直接运行包里的东西 比如这样 python h/out.py 会报“Attempted relative import in non-package” 而这样 python -m h.out 会报"Attempted relative import beyond toplevel package" 真要跑就照一楼这样跑吧。。。 要把整个这一坨当成一个包 才能用relative import |
4 1989922yan OP @TankyWoo 赞,这是个好办法 |
5 1989922yan OP |
6 1989922yan OP |