Installation and use of Mac Neo4j

download link

Select Community Serve and select the compressed package download under the corresponding system.

Here I am directly using the Neo4j Desktop green installation.

1: Open Neo4j Desktop

2: To the right of Projects in the upper left corner of the window, click New->New Project, then click Add on the right to add a database, and name it text123 and password 123.

3: Click Start to start. The process is really long!

4: After startup, you can click Open to browse the web page.

At this time, the interface does not have any nodes. Here we use python to create nodes and relationships.

How to create it? Requires middleware: py2neo

As for how to install python, I won’t go into details here, just Baidu.

py2neo installation command: pip install py2neo

After the installation is successful, enter the command line: pip list to see py2neo and the corresponding version.

Here I stepped on a pitfall: the computer has two pips, one is the global pip, and the other is the pip in conda. In order to make pip in conda take effect, I directly configured the environment variable: alias pip=/opt/anaconda3/envs/pytorch/bin/pip3

Now start typing the code:

Pitfall 1: http://localhost:7474 needs to be changed to bolt://localhost:7687

from py2neo import Graph, Node

graph = Graph("bolt://localhost:7687", auth=("neo4j", "123"))

Person2 = Node('Person', name='于一博')    
graph.create(Person2)  # 创建结点

Guess you like

Origin blog.csdn.net/disiongo/article/details/128447220