1

我正在按照本教程Djangoneo4j开始,但是当第一次导入时,我收到了这个错误:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/core/management/base.py", line 329, in run_from_argv
    connections.close_all()
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/db/utils.py", line 220, in close_all
    for alias in self:
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/db/utils.py", line 214, in __iter__
    return iter(self.databases)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/utils/functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/db/utils.py", line 147, in databases
    self._databases = settings.DATABASES
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
    self._setup(name)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/django/conf/__init__.py", line 107, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraph/AttractoraGraph/settings.py", line 14, in <module>
    from neomodel import config
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/neomodel/__init__.py", line 3, in <module>
    from .core import *
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/neomodel/core.py", line 9, in <module>
    from neomodel.util import Database, classproperty, _UnsavedNode, _get_node_properties
  File "/Users/hugovillalobos/Documents/Code/AttractoraGraphProject/AttractoraGraphVenv/lib/python3.6/site-packages/neomodel/util.py", line 8, in <module>
    from neo4j.v1 import GraphDatabase, basic_auth, CypherError, SessionError, Node
ImportError: cannot import name 'Node'

这是我settings.py拨打电话的代码:

import os
from neomodel import config ## <<---------- Here is where the error rises

config.DATABASE_URL = 'bolt://neo4j:neo4j@localhost:7687'

这是结果pip list

(AttractoraGraphVenv) MacBook-Pro-de-Hugo:AttractoraGraph hugovillalobos$ pip list
Package             Version
------------------- -------
aniso8601           3.0.2  
Django              2.1.5  
django-filter       2.1.0  
djangorestframework 3.9.1  
graphene            2.1.3  
graphql-core        2.1    
graphql-relay       0.4.5  
Markdown            3.0.1  
neo4j               1.7.1  
neo4j-driver        1.6.2  
neobolt             1.7.3  
neomodel            3.3.0  
neotime             1.0.0  
Pillow              5.4.1  
pip                 19.0.1 
promise             2.2.1  
pytz                2018.9 
rosetta             0.3    
Rx                  1.6.1  
setuptools          28.8.0 
six                 1.12.0 
websockets          7.0

我想我缺少安装其他一些组件,但我不知道是哪一个。

4

1 回答 1

0

我从来不知道是什么问题,但我发现它是在我第一次安装neo4j 驱动程序时出现的,然后是 neomodel。我发现我必须让neomodel安装所有依赖项才能正常工作。

于 2019-02-01T18:17:23.127 回答