Skip to main content
 首页 » 编程设计

python json模块导入错误

2025年05月04日10emanlee

我在使用 python json 模块时遇到以下错误

# python 
Python 2.4.3 (#1, Jan 11 2013, 02:09:42)  
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import json 
Traceback (most recent call last): 
  File "<stdin>", line 1, in ? 
ImportError: No module named json 
>>>  

有人可以帮我解决这个问题吗?

请您参考如下方法:

使用 simplejson 就可以了

# python 
Python 2.4.3 (#1, Jan 11 2013, 02:09:42)  
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import simplejson 
>>>