python报错 AttributeError: module ‘collections‘ has no attribute ‘Callable‘

在python 3.10中一启动就会报这个错

AttributeError: module 'collections' has no attribute 'Callable'

解决方法

进入python安装目录 如我的在C盘下修改py3k_compat.py这个文件C:\python311\lib\site-packages\pyreadline\py3k_compat.py

在第8行把 return isinstance(x, collections.Callable)改为 return isinstance(x, collections.abc.Callable)即可正常使用
参考
https://github.com/hylang/hy/issues/2114

猜你喜欢

转载自blog.csdn.net/m0_52051132/article/details/129421894