neo4j-python驱动程序,服务不可用 [英] neo4j - python driver, Service unavailable

查看:89
本文介绍了neo4j-python驱动程序,服务不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对neo4j还是陌生的,我试图建立从python3.6到neo4j的连接.我已经安装了驱动程序,而我刚开始执行第一步:

I am very new to neo4j and I am trying to stablish a connection from python3.6 to neo4j. I have installed the driver and I am just getting started with the first steps:

导入请求 导入操作系统 导入时间 导入urllib 从neo4j.v1导入GraphDatabase,basic_auth

import requests import os import time import urllib from neo4j.v1 import GraphDatabase, basic_auth

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

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

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

However, already in this step I am getting an error:

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上成功启用螺栓.

Before doing this, I have started neo4j from the Terminal, and the bolt was successfully enabled on localhost:7687.

有什么主意为什么会出现这个错误?

Any ideas why I might be getting this error?

非常感谢

推荐答案

我遇到了同样的问题,似乎是本地主机默认情况下解析为ipv6,该驱动程序版本尚无法处理.

I had the same issue, it seems to be that localhost resolves by default to ipv6, which that driver version cannot handle yet.

所以我只是将localhost更改为:127.0.0.1,它开始工作.

So I just changed localhost to: 127.0.0.1 and it worked.

这篇关于neo4j-python驱动程序,服务不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆