导入lru_cache

时间:2015-11-06 04:08:02

标签: python json jsonschema lru

Python版本:2.6

我已经安装了jsonschema模块。

尝试运行架构验证时,我收到ImportError: No module named lru。我正在使用的功能是:

def validateConfig(jsonContent):
    try:
        jsonschema.validate(jsonContent, json.loads(schema))
    except jsonschema.ValidationError as e:
        print e.message
    except jsonschema.SchemaError as e:
        print e.message

我得到的错误:

File "/usr/lib/python2.6/site-packages/jsonschema-2.5.1-py2.6.egg/jsonschema/__init__.py", line 12, in <module>
from jsonschema.exceptions import (
File "/usr/lib/python2.6/site-packages/jsonschema-2.5.1-py2.6.egg/jsonschema/exceptions.py", line 6, in <module>
from jsonschema import _utils
File "/usr/lib/python2.6/site-packages/jsonschema-2.5.1-py2.6.egg/jsonschema/_utils.py", line 6, in <module>
from jsonschema.compat import str_types, MutableMapping, urlsplit
File "/usr/lib/python2.6/site-packages/jsonschema-2.5.1-py2.6.egg/jsonschema/compat.py", line 37, in <module>
from repoze.lru import lru_cache
ImportError: No module named lru

我尝试过的其他事情:

  • repoze.lru module
  • 获取最新的兼容pypi
  • 还尝试在python terminal中运行这些
    • from repoze.lru import lru_cache
    • from repoze.lru import lru
    • from repoze.lru import *

以上所有都会出现同样的错误:

>> import repoze
>> from repoze.lru import lru_cache
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named repoze.lru

0 个答案:

没有答案