我想在Mac High Sierra系统上使用Python 3。我使用以下方法安装了brew ...
localhost:tmp davea$ echo $json
{"id": "abc", "name": "dave"}
localhost:tmp davea$ echo $json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["id"])'
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fff9f066380 (most recent call first):
Abort trap: 6
localhost:tmp davea$ echo $json | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["id"])'
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fff9f066380 (most recent call first):
Abort trap: 6:
但是,当我尝试运行一个简单的命令时,出现“ ModuleNotFoundError:没有名为'encodings'的模块”错误。我只是想解析一些JSON。要正确安装Python,我还需要做些什么?
div.son