步驟:
1.安裝Visual C++,目前最新是2019版
安裝工作負載c++桌面開發
2.pip3安裝模塊
pip3 install pure-sasl==0.5.1 pip3 install thrift-sasl==0.2.1 --no-deps pip3 install thrift==0.9.3 pip3 install impyla==0.14.1 pip3 install bitarray==0.8.3 pip3 install thriftpy==0.3.9
安裝時報錯:
# TypeError: can't concat str to bytes
3.改錯
編輯 python安裝目錄/site-packages/thrift_sasl/__init__.py
# 定位到錯誤的最后一條,在init.py第94行 (注意代碼的縮進)
header = struct.pack(">BI", status, len(body)) self._trans.write(header + body)
更改為:
header = struct.pack(">BI", status, len(body)) if(type(body) is str): body = body.encode() self._trans.write(header + body)
4.重新pip安裝