import相对路径问题 Posted on 2019-01-15 Edited on 2025-03-12 In Python 示例 This is because when executing relative.py, from .. import parent, the directory pkg is no longer treated as a package. Therefore, sub is the topmost package. .. is beyond toplevel package. 看样子应该主程序入口是不可以向上import?