使用 Python 与 Bolt 协议和 Neo4j 相关的连接问题

Connection problem related to Bolt Protocol and Neo4j using Python

我正在尝试使用 Python 连接到 Neo4j,但我在行

中收到与 Bolt 协议相关的错误
driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "neo4j"))

我运行 代码使用驱动程序neo4j-driver 4.0.2。我也试过 neo4j-driver 4.1.1,我遇到了同样的问题。

我是不是缺少一些配置?

Traceback (most recent call last):
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\__init__.py", line 194, in bolt_driver
    return BoltDriver.open(target, auth=auth, **config)
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\__init__.py", line 357, in open
    pool = BoltPool.open(address, auth=auth, pool_config=pool_config, workspace_config=default_workspace_config)
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 510, in open
    seeds = [pool.acquire() for _ in range(pool_config.init_size)]
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 510, in <listcomp>
    seeds = [pool.acquire() for _ in range(pool_config.init_size)]
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 523, in acquire
    return self._acquire(self.address, timeout)
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 395, in _acquire
    connection = self.opener(address, timeout)
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 507, in opener
    return Bolt.open(addr, auth=auth, timeout=timeout, **pool_config)
  File "C:\Users\Anita Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\io\__init__.py", line 212, in open
    raise BoltHandshakeError("The Neo4J server does not support communication with this driver. This driver have support for Bolt Protocols {}".format(supported_versions), address=address, request_data=handshake, response_data=data)
neo4j._exceptions.BoltHandshakeError: The Neo4J server does not support communication with this driver. This driver have support for Bolt Protocols dict_keys([Version(3, 0), Version(4, 0)])

 The above exception was the direct cause of the following exception:
 
 Traceback (most recent call last):   File "src/load_db.py", line 11,
 in <module>
     driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "neo4j"))   File "C:\Users\Anita
 Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\__init__.py",
 line 181, in driver
    return cls.bolt_driver(parsed.netloc, auth=auth, **config)   File "C:\Users\Anita
 Caron\AppData\Local\Programs\Python\Python38\lib\site-packages\neo4j\__init__.py",
 line 197, in bolt_driver
     raise ServiceUnavailable(str(error)) from error neo4j.exceptions.ServiceUnavailable: The Neo4J server does not support
 communication with this driver. This driver have support for Bolt
Protocols dict_keys([Version(3, 0), Version(4, 0)])

尝试刷新 tox 缓存,如本文所述neo4j issue