多语言展示
当前在线:457今日阅读:168今日分享:49

module has no attribute

import log_function as logfunlogfun.printlog1(3, 5, 0.4, 0.5)调用方法时报错:module 'log_function' has no attribute 'printlog1'
工具/原料
1

jupyter

2

python3

方法/步骤
1

定义有def printlog1(a, b, c, d):方法,在jupyter中引用

2

初次引用的时候正常,如果将方法名修改后,再次引用,会报错:调用方法时报错:module 'log_function' has no attribute 'printlog1'

3

解决方法:单击重启按钮,restart the kernel

4

该问题常发生在方法名修改,或者增加新的方法的时候,使用jupyter报错,但是在pycharm中访问正常,不确定是否跟jupyter版本有关系

推荐信息