Python 3.x Python3模块打包文件结构和初始化文件
我有一个Python模块,其中包含一个文件和一个函数。我已经将其上传到pypi,并使用以下结构对其进行打包,但当我调用模块文件中的函数时,我收到此错误:Python 3.x Python3模块打包文件结构和初始化文件,python-3.x,module,structure,init,Python 3.x,Module,Structure,Init,我有一个Python模块,其中包含一个文件和一个函数。我已经将其上传到pypi,并使用以下结构对其进行打包,但当我调用模块文件中的函数时,我收到此错误: AttributeError: module 'effInput' has no attribute 'ask' ('ask'是函数名) 模块包结构: |--effInput |--__init__. py |--effInput.py (module file) |--setup.py |--readme.txt |--L
AttributeError: module 'effInput' has no attribute 'ask'
('ask'是函数名)
模块包结构:
|--effInput
|--__init__. py
|--effInput.py (module file)
|--setup.py
|--readme.txt
|--LICENSE
init.py文件:
import effInput
name="EffInput"
我做错了什么 这样做时,您必须调用
effInput.effInput.ask
而不是effInput.ask
。如果您在\uu init\uuuuuupy.py
中使用了来自effInput import*的,它应该按预期工作。并且我应该将init.py文件放在包根目录中或模块文件旁边?模块文件旁边。