Python 3.x 什么';这个Python文件夹结构有什么问题?

Python 3.x 什么';这个Python文件夹结构有什么问题?,python-3.x,directory-structure,Python 3.x,Directory Structure,我以为我理解了Python3的模块模型,但也许不是 我有一棵像这样的树: root \-- pmlr \-- __init__.py * empty \-- pmlr.py * full of definitions 当我在root中,并且从Python3 shellimport pmlr运行时,pmlr仅具有以下属性(默认包\u dict\u): 这意味着python认为pmlr是一个包,但它找不到它的任何属性 如果Icd pmlr并将其导入,则会显示模块的所有属性。

我以为我理解了Python3的模块模型,但也许不是

我有一棵像这样的树:

root
\-- pmlr
    \-- __init__.py * empty
    \-- pmlr.py     * full of definitions
当我在
root
中,并且从Python3 shell
import pmlr
运行时,
pmlr
仅具有以下属性(默认包
\u dict\u
):

这意味着
python
认为
pmlr
是一个包,但它找不到它的任何属性

如果I
cd pmlr
并将其导入,则会显示模块的所有属性。如果我从根目录导入pmlr.pmlr,则显示模块的所有属性

如何使我的模块作为其文件夹(
pmlr
)从根目录导入,而不是作为
pmlr.pmlr
?我认为是
\uuuu init\uuuuuuuy.py
实现了这一点。

在评论中解释了这一点:


\uuuu init\uuuu.py
中,使用pmlr import*中的

在评论中解释了这一点:


\uuuu init\uuuu.py
中,使用pmlr import*
中的


\uuuu init\uuuuuuuuuuuuuuuuupy
中使用
from.pmlr import*
@Rogalski post作为答案,谢谢--我没想到在
\uuuuuuuuuuuuuuuuuuuuuuuuuuupy
中使用
from.pmlr import*
@Rogalski post作为答案,谢谢--我没想过要这么做
pmlr.__cached__         pmlr.__dir__(           pmlr.__format__(        pmlr.__hash__(          pmlr.__lt__(            pmlr.__package__        pmlr.__repr__(          pmlr.__str__(
pmlr.__class__(         pmlr.__doc__            pmlr.__ge__(            pmlr.__init__(          pmlr.__name__           pmlr.__path__           pmlr.__setattr__(       pmlr.__subclasshook__(
pmlr.__delattr__(       pmlr.__eq__(            pmlr.__getattribute__(  pmlr.__le__(            pmlr.__ne__(            pmlr.__reduce__(        pmlr.__sizeof__(        
pmlr.__dict__           pmlr.__file__           pmlr.__gt__(            pmlr.__loader__         pmlr.__new__(           pmlr.__reduce_ex__(     pmlr.__spec__