【问题标题】:AttributeError: type object 'Callable' has no attribute '_abc_registry'AttributeError:类型对象“可调用”没有属性“_abc_registry”
【发布时间】:2019-09-13 22:55:04
【问题描述】:

当我打开 jupyter notebook 时出现错误。

我使用谷歌寻求帮助,但找不到答案。

我在 macOS mojave 上使用 python 3.7.2。我重新安装了我的 Jupiter notebook 但没有任何变化。

当我输入 jupyter notebook.它告诉我这些

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'

【问题讨论】:

    标签: python macos jupyter python-3.7


    【解决方案1】:

    尝试卸载打字:

    pip uninstall typing
    

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

    如果之后你得到:

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

    试试pip uninstall dataclasses

    有关更多信息,请参阅: https://github.com/RTIInternational/gobbli/issues/10

    【讨论】:

    • 当使用 Pip 版本 20.1(2020 年 4 月 29 日发布)时,卸载 typing 包的解决方案由于某种原因不再有效。一个简单的解决方法是确保您使用的是以前版本的 Pip,20.0.2,该解决方案仍然有效。
    • typing 包仅适用于 Python typing 模块,所以无论如何你都应该卸载它。
    • 你是真正的 MVP @WhyNotHugo。我正在使用 python 3.8,显然,像 pandas 或 scrapy 这样的一些包仍然将输入列为要求,并且从 pipfile 安装所有内容都失败了。所以解决方案是生成 pipenv.lock 文件并从中删除输入。
    • 在 python 3.8.5 中出现同样的错误,输入版本 3.7.4.3。卸载输入解决了我的问题。
    • 我在 3.8 中也遇到过这个问题,但无法让 pip 运行卸载。我必须将目录更改为我的站点包目录并 rm -rf typing* 手动卸载它。 /usr/local/lib/python3.8/site-packages 是我的。
    猜你喜欢
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 2020-01-05
    • 2021-11-09
    • 2019-06-08
    • 2022-01-12
    • 2016-11-18
    相关资源
    最近更新 更多