【发布时间】:2021-05-28 07:40:05
【问题描述】:
我想在我的 python 脚本中使用 json 解析器。 当我导入 json 模块时,会出现 ImportError:
root@msc-nr-imx6x:~# python3
Python 3.5.2 (default, Aug 9 2017, 22:59:34)
[GCC 6.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'json'
>>>
我认为在 python3 中,json 是内置的。 Python 正在运行 - arm imx6、yocto 2.2、python 3.5.2
那么我该如何安装json模块呢?
谢谢
编辑 - 添加 test.py 脚本的输出:
try:
import json
except ImportError:
import simplejson as json
输出:
root@msc-nr-imx6x:~# python3 test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
import json
ImportError: No module named 'json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 4, in <module>
import simplejson as json
ImportError: No module named 'simplejson'
【问题讨论】:
标签: json python-3.x embed yocto