openwrt上单独安装python-light使用json的问题

如果单独安装python-light,就是最基本的python,在import json的时候会出错,说找不到encoding

root@OpenWrt:~# python2.7
Python 2.7.9 (default, Jan 27 2016, 17:49:20) 
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/json/__init__.py", line 108, in 
    from .decoder import JSONDecoder
  File "/usr/lib/python2.7/json/decoder.py", line 24, in 
    NaN, PosInf, NegInf = _floatconstants()
  File "/usr/lib/python2.7/json/decoder.py", line 18, in _floatconstants
    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
LookupError: no codec search functions registered: can't find encoding

是因为没有安装python-codecs,安装上去就没问题了。

你可能感兴趣的:(openwrt,Python)