gpt4 book ai didi

django - 在neo4j中创建对象的问题

转载 作者:行者123 更新时间:2023-12-02 06:58:35 26 4
gpt4 key购买 nike

我正在使用 neo4j 的 django 集成,当我尝试创建节点时,我收到以下回溯。
我确实安装了 JPype 并且可以导入它。

 p = Person.objects.create(first_name='omer', last_name='katz')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 138, in create
return self.get_query_set().create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/model/django_model/__init__.py", line 362, in create
obj.save(force_insert=True)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 460, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_util.py", line 47, in __get__
method, graphdb = self.descr_get(obj, cls)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_util.py", line 41, in descr_get
graphdb = self.accessor.__get__(obj, cls)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/model/django_model/__init__.py", line 58, in __get__
return DjangoNeo.neo
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/model/django_model/__init__.py", line 124, in neo
return self.__setup_neo()
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/model/django_model/__init__.py", line 136, in __setup_neo
self.__neo = NeoService(resource_uri, **options)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/__init__.py", line 522, in __new__
neo = core.load_neo(resource_uri, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_core.py", line 180, in load_neo
backend.initialize(**parameters)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 61, in initialize
raise ImportError("No applicable backend found.")
ImportError: No applicable backend found.

编辑:
按照这里的要求是我的 neo4j 设置:

NEO4J_RESOURCE_URI = '/var/neo4j/neo4django'
# NEO4J_RESOURCE_URI should be the path to where
# you want to store the Neo4j database.

NEO4J_OPTIONS = {
# this is optional and can be used to specify
# extra startup parameters for Neo4j, such as
# the classpath to load Neo4j from.
}

编辑:
遵循 thobe 的建议后,当我尝试导入自己的模型时,我得到以下信息:

    ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
FERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

ile "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ERROR:root:Importing native backends failed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/__init__.py", line 51, in initialize
embedded, remote = implementation.initialize(classpath, params)
File "/usr/local/lib/python2.7/dist-packages/Neo4j.py-0.1_SNAPSHOT-py2.7.egg/neo4j/_backend/reflection.py", line 44, in initialize
jvm = jpype.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_core.py", line 96, in getDefaultJVMPath
return _linux.getDefaultJVMPath()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 36, in getDefaultJVMPath
jvm = _getJVMFromJavaHome()
File "/usr/local/lib/python2.7/dist-packages/jpype/_linux.py", line 55, in _getJVMFromJavaHome
if os.path.exists(java_home+"/bin/javac") :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

最佳答案

您可以通过将其添加到 NEO4J_OPTIONS 来获取有关为何找不到后端的更详细信息:

NEO4J_OPTIONS = {
log: True,
}

该日志记录的输出将使诊断实际问题并提出修复建议变得更加容易。

关于django - 在neo4j中创建对象的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6384050/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com