2016-02-15 26 views
0

我在使用neo4j的python中的代码遇到问题。neo4j,python和netbeans

我的代码:

from neo4jrestclient.client import GraphDatabase 

db = GraphDatabase("http://localhost:7474",username="neo4j", password="neo4j") 

# Create some nodes with labels 
user = db.labels.create("User") 
u1 = db.nodes.create(name="Marco") 
user.add(u1) 
u2 = db.nodes.create(name="Daniela") 
user.add(u2) 

beer = db.labels.create("Beer") 
b1 = db.nodes.create(name="Punk IPA") 
b2 = db.nodes.create(name="Hoegaarden Rosee") 
# You can associate a label with many nodes in one go 
beer.add(b1, b2) 

# User-likes->Beer relationships 
u1.relationships.create("likes", b1) 
u1.relationships.create("likes", b2) 
u2.relationships.create("likes", b1) 
# Bi-directional relationship? 
u1.relationships.create("friends", u2) 

错误: 回溯(最近通话最后一个): 文件 “/home/jessica/NetBeansProjects/NovoBanco/src/novobanco.py”,1号线,在 from neo4jrestclient.client import GraphDatabase ImportError:没有名为neo4jrestclient.client的模块

回答

0

neo4jrestclient软件包无法被您正在使用的Python解释器访问。例如。

$ python 
>>> from neo4jrestclient.client import GraphDatabase 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named neo4jrestclient.client 

安装软件包:

$ sudo pip install neo4jrestclient 
[...] 
Successfully installed neo4jrestclient-2.1.1 

...然后你应该能够与您的项目向前推进:

>>> from neo4jrestclient.client import GraphDatabase 

(没有错误这一次)。