TypeError:“frozenset”对象不可调用;Python2.7

2024-04-20 13:24:34 发布

您现在位置:Python中文网/ 问答频道 /正文

Traceback (most recent call last):
File "sample.py", line 7, in
from ctypes.util import find_library
File "/usr/local/lib/python2.7/dist-packages/ctypes-1.0.2-py2.7-linux-x86_64.egg/ctypes/util.py", line 46, in
import re, tempfile, errno
File "/usr/lib/python2.7/tempfile.py", line 35, in
from random import Random as _Random
File "/usr/lib/python2.7/random.py", line 49, in
import hashlib as _hashlib
File "build/bdist.linux-x86_64/egg/hashlib.py", line 115, in
"""
TypeError: 'frozenset' object is not callable

如何解决这个问题?


Tags: infrompyimportegglinuxlibusr
2条回答

既然你没有任何代码,我猜如果你做了这样的事情:

my_frozenset_obj(some_index)

而不是这个:

my_frozenset_obj.pop()

如果希望能够通过索引访问项,则应使用非集合的数据结构。

我今天收到同样的错误。 对我来说,解决方案是在我的项目路径/eggs/hashlib-20081119-py2.7-linux-x86-egg/hashlib.py的第129行中用except:替换:except ImportError:

似乎这与funcName的值md_meth_names有关,这个讨论帮助了我:https://askubuntu.com/questions/575598/python-attributeerror-with-hashlib-no-such-attribute-openssl-md-meth-names

相关问题 更多 >