关于python:TypeError:’frozenset’对象不可调用;Python2.7

TypeError: 'frozenset' object is not callable; Python2.7

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

如何解决这个问题?


我今天收到同样的错误。
对我来说,解决方案是在my_project_path / eggs / hashlib-20081119-py2.7-linux-x86_64.egg / hashlib.py的129行替换:except ImportError:except:

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


由于你没有任何代码,我最好猜测你是否做过这样的事情:

1
my_frozenset_obj(some_index)

而不是这个:

1
my_frozenset_obj.pop()

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