neo4j - python驱动程序,服务不可用

时间:2017-03-29 12:26:27

标签: python-3.x api neo4j

我对neo4j很新,我正试图建立从python3.6到neo4j的连接。我已经安装了驱动程序,我刚开始使用第一步:

  

导入请求   进口口   进口时间   import urllib   来自neo4j.v1导入GraphDatabase,basic_auth

     

GraphDatabase.driver(" bolt:// localhost:7687",auth = basic_auth(" neo4j"," myPass"))

但是,在此步骤中我已收到错误:

driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "myPass"))
Traceback (most recent call last):

  File "<ipython-input-5-9ba197b31f8c>", line 1, in <module>
    driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "myPass"))

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/v1/api.py", line 112, in driver
    return driver_class(uri, **config)

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/v1/direct.py", line 56, in __init__
    pool.acquire()

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/v1/direct.py", line 37, in acquire
    return self.acquire_direct(resolved_addresses[0])

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 386, in acquire_direct
    connection = self.connector(address)

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/v1/direct.py", line 55, in <lambda>
    pool = DirectConnectionPool(lambda a: connect(a, security_plan.ssl_context, **config), self.address)

  File "/Users/backup/anaconda/lib/python3.6/site-packages/neo4j/bolt/connection.py", line 457, in connect
    raise ServiceUnavailable("Failed to establish connection to {!r}".format(address))

ServiceUnavailable: Failed to establish connection to ('::1', 7687, 0, 0)

在此之前,我已经从终端启动了neo4j,并且在localhost:7687上成功启用了螺栓。

我可能会收到此错误的任何想法?

提前多多感谢

4 个答案:

答案 0 :(得分:2)

我有同样的问题,似乎localhost默认解析为ipv6,该驱动程序版本无法处理。

所以我刚将localhost更改为:127.0.0.1并且它有效。

答案 1 :(得分:2)

尝试在本地运行时,将 encrypted = False 用作GraphDatabase.driver的参数之一

driver = GraphDatabase.driver(“ bolt:// localhost:7687”,auth =(“ neo4j”,“ myPass”),加密= False)

答案 2 :(得分:1)

以下为我工作,

请注意data <- data.frame( ID = c(1, 1, 3, 6, 6), S1 = c(2, 2, 1, 2, 7), C = c(3, 3, 1, 5, 5) ) library(dplyr) data.filtered <- data[data$S1 <= data$C,] data.filtered %>% group_by(ID) %>% summarize(Obs = length(ID)) ,端口neo4j://7687参数

auth

我的桌面看起来像这样,

enter image description here

答案 3 :(得分:0)

我不确定确切的错误,但是我在使用Python 3.6时遇到了一些问题,因此我改用python 2.7,它可以正常工作。 另外,在尝试连接数据库之前,必须确保已建立neo4j连接,具体取决于安装neo4j的位置。就我而言,将是以下命令:〜/ soft / neo4j / bin / neo4j控制台