3
正如我試圖從ConceptNet導入模塊(從conceptnet.models導入概念),我收到此錯誤信息:從django.db進口utils的導入錯誤:無法導入名稱utils的
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引起的,我試過了,導入django.db並且這足以讓我發生同樣的錯誤。有些東西告訴我這裏有一些循環:import django.db設置一些動作,在某些時候試圖從django.db中導入某些東西。我不知道如何做這個工作?