安装/卸载软件包时,获取模块“abc”没有属性“update_abstractmethods”错误

问题描述 投票:0回答:1

从几天前开始,每次我尝试将任何软件包下载到我的环境(或直接通过终端进行 pip 安装)和/或删除/卸载我的环境中的现有软件包时,我都会收到软件包安装/卸载失败错误: 文件“C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages ttr_make.py”,第 740 行,在 build_class 中 返回 self.abc.update_abstractmethods( AttributeError:模块“abc”没有属性“update_abstractmethods”。

我确保 abc 库是可导入的(没有问题)。 2.在 _make.py 文件上,我跟踪了构建类函数,它看起来像这样:

if PY310:
import abc
def build_class(self):
"""
Finalize class based on the accumulated configuration.
Builder cannot be used after calling this method.
"""
if self._slots is True:
return self._create_slots_class()
return self.abc.update_abstractmethods(
self._patch_original_class()
)

值得一提的是,在问题开始之前,所有现有的脚本和库都工作正常,只是似乎无法使 pycharm 下载任何包(几天前才随机开始,也许是在我尝试之后) pip 安装某个库)

python installation pip package abc
1个回答
0
投票

abc.update_abstractmethods()
在 Python 3.10 中添加。您正在运行Python 3.9(从路径“C:\ Users \ user_name \ AppData \ Local \ Programs \ Python \ Python39 \ lib \ site-packages ttr_make.py”猜测),因此该方法不可用。

© www.soinside.com 2019 - 2024. All rights reserved.