TypeError: 'module' object is not callable

2025-04-24 05:45:51

1、test是模块, class test是类

TypeError: 'module' object is not callable

2、import导入的是模块test,模块test是不能实例化的

TypeError: 'module' object is not callable

3、模块test里的test类是可以实例化的

TypeError: 'module' object is not callable

4、所以此处应该写t = test.test()

TypeError: 'module' object is not callable

5、或者用form 包名.模块名 import 类名的方式导入

TypeError: 'module' object is not callable

6、这样就可以正常运行了,搞清楚包,模块和类的区别即可

TypeError: 'module' object is not callable
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢