AttributeError:“函数”对象没有属性“配置”

2024-05-18 07:54:51 发布

您现在位置:Python中文网/ 问答频道 /正文

目前正在尝试使用neat模块编写程序。此时,当我运行程序时,我应该看到一个窗口弹出,活动正在进行。相反,我看到的信息是:

AttributeError:“函数”对象没有属性“配置”

错误似乎出现在以下几行中:

def run(config_file):
    config = neat.config.Config(neat.DefaultGenome, neat.DefaultReproduction,
                            neat.DefaultSpeciesSet, neat.DefaultStagnation,
                            config_file)

    p = neat.Population(config)

    p.add_reporter(neat.StdOutReporter(True))
    stats = neat.StatisticsReporter()
    p.add_reporter(stats)


if __name__ == '__main__':
    local_dir = os.path.dirname(__file__)
    config_path = os.path.join(local_dir, 'config-feedforward.txt')
    run(config_path)

这段代码是直接从工作源代码粘贴的,所以我不清楚原因是什么。任何帮助都将不胜感激


Tags: 模块pathrun程序add信息configos