python3.10使用jupyter notebook报错:‘attributeerror: module ‘collections‘ has no attribute ‘callable’’

报错原因

collections.Callable has been moved to collections.abc.Callable in python 3.10+

解决方法:

  1. 找到你python安装路径 (如何获取python的安装路径)

  2. 进入python安装路径下的Python310\Lib\site-packages\pyreadline。

    如果没找到pyreadline这个文件夹需要手动安装pyreadline

    pip install pyreadline
    
  3. 打开py3k_compat.py

  4. 将第8行从isinstance(x, collections.Callable)更改为isinstance(x, collections.abc.Callable)

  5. 保存,退出,重新打开jupyter notebook

猜你喜欢

转载自blog.csdn.net/xili1342/article/details/132037275