TypeError:' frozenset'对象不可调用

时间:2016-10-10 22:29:00

标签: python hashlib

我试图在gcloud实例上安装hashlib python模块。

我不能因为这个错误:

Collecting hashlib
Downloading hashlib-20081119.zip (42kB)
100% |################################| 51kB 8.3MB/s 
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
    from setuptools.extern.six.moves import filterfalse, map
  File "/usr/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in <module>
    import email.parser
  File "/usr/lib/python2.7/email/parser.py", line 12, in <module>
    from email.feedparser import FeedParser
  File "/usr/lib/python2.7/email/feedparser.py", line 27, in <module>
    from email import message
  File "/usr/lib/python2.7/email/message.py", line 16, in <module>
    import email.charset
  File "/usr/lib/python2.7/email/charset.py", line 13, in <module>
    import email.base64mime
  File "/usr/lib/python2.7/email/base64mime.py", line 40, in <module>
    from email.utils import fix_eols
  File "/usr/lib/python2.7/email/utils.py", line 27, in <module>
    import random
  File "/usr/lib/python2.7/random.py", line 49, in <module>
    import hashlib as _hashlib
  File "hashlib.py", line 115, in <module>
    f()
TypeError: 'frozenset' object is not callable

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-MduVxt/hashlib/

所以,我尝试使用easy_install代替:

sudo easy_install hashlib
Searching for hashlib
Reading https://pypi.python.org/simple/hashlib/
Best match: hashlib 20081119
Downloading https://pypi.python.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip#md5=46e59db6d5cac34b3344ef0c30d0897f
Processing hashlib-20081119.zip
Writing /tmp/easy_install-EENwwt/hashlib-20081119/setup.cfg
Running hashlib-20081119/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EENwwt/hashlib-20081119/egg-dist-tmp-ukAV7B
no previously-included directories found matching 'build'
no previously-included directories found matching 'dist'
no previously-included directories found matching 'RCS'
no previously-included directories found matching 'CVS'
no previously-included directories found matching '.svn'
zip_safe flag not set; analyzing archive contents...
Moving hashlib-20081119-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages
Adding hashlib 20081119 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/hashlib-20081119-py2.7-linux-x86_64.egg
Processing dependencies for hashlib
Finished processing dependencies for hashlib

一切似乎都很好,但是,在此之后,每次我出于pipeasy_install出于任何原因,它都会向我显示:

pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 13, in <module>
from pip.exceptions import InstallationError, CommandError, PipError
File "/usr/lib/python2.7/dist-packages/pip/exceptions.py", line 6, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
vendored("cachecontrol")
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 3, in <module>
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/__init__.py", line 53, in <module>
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/packages/__init__.py", line 29, in <module>
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/__init__.py", line 8, in <module>
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 35, in <module>
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 14, in <module>
File "/usr/lib/python2.7/httplib.py", line 80, in <module>
import mimetools
File "/usr/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/usr/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
File "/usr/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "build/bdist.linux-x86_64/egg/hashlib.py", line 115, in <module>
"""
TypeError: 'frozenset' object is not callable

同样适用于easy_install

sudo easy_install -m hashlib
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in <module>
import email.parser
File "/usr/lib/python2.7/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser
File "/usr/lib/python2.7/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/usr/lib/python2.7/email/charset.py", line 13, in <module>
import email.base64mime
File "/usr/lib/python2.7/email/base64mime.py", line 40, in <module>
from email.utils import fix_eols
File "/usr/lib/python2.7/email/utils.py", line 27, in <module>
import random
File "/usr/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "build/bdist.linux-x86_64/egg/hashlib.py", line 115, in <module>
"""
TypeError: 'frozenset' object is not callable

有关如何卸载或修复它的任何想法?

在这种情况下,我可以运行任何这些命令。

提前致谢!

0 个答案:

没有答案