[英]pip is broken and gives typeerror from_buffer() cannot return
[英]pip commands return a TypeError
我需要為我的一個項目安裝hashlib
,並使用easy_install hashlib
(如本Stack Exchange post所述 )。 但是,在安裝此軟件包后,我根本無法使用pip。 每當我使用pip
鍵入命令時(例如pip install
),都會收到以下錯誤消息:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 37, in <module>
import email.parser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/feedparser.py", line 27, in <module>
from email import message
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/charset.py", line 13, in <module>
import email.base64mime
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/base64mime.py", line 40, in <module>
from email.utils import fix_eols
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/utils.py", line 27, in <module>
import random
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "build/bdist.macosx-10.13-intel/egg/hashlib.py", line 115, in <module>
"""
TypeError: 'frozenset' object is not callable
現在,當我使用easy_install
時,也會發生這種情況-同樣的錯誤。 我也無法卸載pip並重新安裝-任何帶有pip
命令都會導致上述錯誤。 甚至執行
pip --version
產生相同的錯誤。 我知道這與hashlib
軟件包有關,但是我不確定如何刪除它並重新安裝而不弄亂我的整個Python配置。 我的假設是,對於我的Python 2.7,我安裝的hashlib
的版本太舊或太新,因此不能很好地使用它。
有誰知道這個堆棧跟蹤中的幕后到底發生了什么,以及我如何解決pip
?
從字面意義上刪除我的lib/python2.7
文件夾中的hashlib.py
是最好的辦法嗎?
所以,這並沒有解決這個問題hashlib
,但它確實讓你工作pip
再次:從字面上下載和各地重新安裝Python 2.7版從源頭 。 如果有人提出了一種更好,更優雅的解決方法來修復pip
,我全力以赴。
但是,至少我可以再次使用pip
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.