AttributeError: type object 'Callable' has no attribute '_abc_registry'

朱嘉宇*_*朱嘉宇 5 python macos jupyter python-3.7

When I open my jupyter notebook I get errors.

I use google for help, but I can't find an answer.

I'm on macOS mojave and using python 3.7.2.I reinstalled my Jupiter notebook but no change.

When I input jupyter notebook. It show me these

Last login: Wed Apr 24 23:06:17
miracleleon@MiracledeMBP ? ~ ? jupyter notebook
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 6, in 
from notebook.notebookapp import main
File "/usr/local/lib/python3.7/site-packages/notebook/init.py", line 25, in 
from .nbextensions import install_nbextension
File "/usr/local/lib/python3.7/site-packages/notebook/nbextensions.py", line 610, in 
from .extensions import (
File "/usr/local/lib/python3.7/site-packages/notebook/extensions.py", line 8, in 
from tornado.log import LogFormatter
File "/usr/local/lib/python3.7/site-packages/tornado/log.py", line 34, in 
from tornado.escape import _unicode
File "/usr/local/lib/python3.7/site-packages/tornado/escape.py", line 27, in 
from tornado.util import unicode_type
File "/usr/local/lib/python3.7/site-packages/tornado/util.py", line 18, in 
import typing
File "/usr/local/lib/python3.7/site-packages/typing.py", line 1356, in 
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/usr/local/lib/python3.7/site-packages/typing.py", line 1004, in new
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
Run Code Online (Sandbox Code Playgroud)

the*_*ron 107

尝试卸载键入:

pip uninstall typing
Run Code Online (Sandbox Code Playgroud)

或将 python 降级到 3.6。输入3.7好像有问题

如果之后你得到:

AttributeError: 模块 'typing' 没有属性 '_ClassVar'

试试pip uninstall dataclasses

更多信息请参考:https : //github.com/RTIInternational/gobbli/issues/10

  • `typing` 包仅与 Python <= 3.5 相关。更高版本包含内置的“打字”模块,因此您无论如何都应该卸载它。 (17认同)
  • 使用 Pip 20.1 版本(2020 年 4 月 29 日发布)时,由于某种原因,卸载 `typing` 包的解决方案不再起作用。一个简单的解决方法是确保您使用的是 Pip 的早期版本 20.0.2,该解决方案仍然有效。 (9认同)
  • 你是真正的 MVP @WhyNotHugo。我正在使用 python 3.8,显然,某些包(例如 pandas 或 scrapy)仍然会根据要求列出输入,并且从 pipfile 安装所有内容都会失败。所以解决方案是生成 pipelinev.lock 文件并从中删除输入。 (3认同)
  • 我在 3.8 中也遇到过这个问题,但无法让 pip 运行卸载。我必须将目录更改为我的 site-packages 目录并 rm -rf Typing* 才能手动卸载它。/usr/local/lib/python3.8/site-packages 是我的位置。 (3认同)
  • 同样的错误发生在 python 3.8.5 中,输入版本 3.7.4.3。卸载打字解决了我的问题。 (2认同)