自动更正python3包错误TypeError:JSON对象必须是str,而不是“bytes”

2024-10-03 23:27:13 发布

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

我使用命令pip install autocorrect安装了autocorrect软件包,但示例代码如下:

    from autocorrect import Speller
     check = Speller(lang='en')
    check("does this sentece have misspelled wordz?")

给我这个错误,它在包文件中:

Traceback (most recent call last): File "D:\a.b.k\study\testauto.py", line 3, in check = Speller(lang='en') File "C:\Users\Abdelrahman Bonna\AppData\Local\Programs\Python\Python35-32\lib\site-packages\autocorrect__init__.py", line 58, in init self.nlp_data = load_from_tar(lang) File "C:\Users\Abdelrahman Bonna\AppData\Local\Programs\Python\Python35-32\lib\site-packages\autocorrect__init__.py", line 52, in load_from_tar return json.load(file) File "C:\Users\Abdelrahman Bonna\AppData\Local\Programs\Python\Python35-32\lib\json__init__.py", line 268, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "C:\Users\Abdelrahman Bonna\AppData\Local\Programs\Python\Python35-32\lib\json__init__.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

我在这个软件包中使用Python3.5,破坏了Windows10


Tags: inpyinitliblocallineloadusers