Python3.12.1版本,安装pip install requests 发生异常:
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
原因:
由于删除了长期弃用的 pkgutil.ImpImporter 类,pip 命令可能不适用于 Python 3.12
解决:
Fix Broken Pip for Python 3.12 in Ubuntu 22.04/20.04 | UbuntuHandbook
只需手动安装 Python 3.12 的 pip
py -m ensurepip --upgrade