当我尝试从 ConceptNet(来自 conceptnet.models import Concept)导入模块时,我收到了以下错误消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/conceptnet/models.py", line 2, in <module>
from django.db import models
File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend
return import_module('.base', backend_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2 /base.py", line 9, in <module>
from django.db import utils
ImportError: cannot import name utils
为了确保这个问题不是由 ConceptNet 中的某些东西引起的,而是由 django.db 引起的,我尝试了 import django.db ,这足以给我同样的错误。有些东西告诉我这里有一些循环:import django.db 设置了一些东西,在某些时候试图从 django.db 导入一些东西。我不知道如何使这项工作?