我正在编写一个 python 模块neuralnet。它在 Python2 中一切正常,但在 Python3 中导入失败。
这是我的代码结构。
neuralnet/
__init__.py
train.py # A wrapper to train (does not define new things)
neuralnet.py # Defines the workhorse class neuralnet
layer/
__init__.py
inlayer.py # Defines input layer class
hiddenlayer.py
application/ # A seperate application (not part of the package)
classify.py # Imports the neuralnet class from neuralnet.py
Run Code Online (Sandbox Code Playgroud)
train.py需要导入neuralnet.py 的neuralnet类。
neuralnet.py需要导入layers/inlayer.py等
(我更喜欢相对进口。)
我有一个不同的应用程序 ( classify.py) 需要导入这个模块。我在哪里...
from neuralnet.neuralnet import neuralnet
Run Code Online (Sandbox Code Playgroud)
我尝试了几种导入方式。要么我得到一个错误(主要是像 parent 这样的神秘未导入)
运行 …