python3.12中AttributeError: module ‘pkgutil‘ has no attribute ‘ImpImporter‘.问题记录
该文章描述了如何解决Python中出现的"AttributeError: module 'pkgutil' has no attribute 'ImpImporter'"错误。解决方法是修改pkg_resources/__init__.py文件,将pkgutil.ImpImporter替换为zipimport.zipimporter。文章指出该问题是由于文件中存在未注释的旧代码
·
AttributeError: module ‘pkgutil’ has no attribute ‘ImpImporter’. Did you mean: ‘zipimporter’?
找到 python\Lib\site-packages\pkg_resources 文件夹 ,打开 __init__.py文件
全局搜索:pkgutil.ImpImporter
将找到的register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
替换为:register_namespace_handler(zipimport.zipimporter, file_ns_handler)
其实这里它已经写过这个了,但是他上边错误的没有注释掉
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)