首页 > 解决方案 > 我想在 django 中可视化数据库图,但在 pygraphviz 中出现问题

问题描述

我正在尝试在 django 中可视化数据库图。

在 Docker 文件中,我有:

运行 apt-get install -y python3-dev graphviz libgraphviz-dev 运行 apt-get install -y python-pygraphviz pkg-config

在 requirements.txt 我有:

django、psycopg2、djangorestframework、PyJWT、gunicorn、频道、django 扩展、graphviz、cGraph、pygraphviz

但我收到此错误:

Building wheel for pygraphviz (setup.py): started
  Building wheel for pygraphviz (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = ... 
  ----------------------------------------
  ERROR: Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Successfully built cGraph
Failed to build pygraphviz ...    ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

关于这个错误的任何想法?

标签: djangodatabasediagram

解决方案


我认为你有错误的包,试试看

docker-compose <-f local.yml> run --rm <containername> pip install graphviz 

或将其添加到您的要求中:

graphviz==0.16 or 0.1*

还将您的 Dockerfile RUN 更改为:

RUN pip install -r /requirements/local.txt

不要调用每个库。

有点晚了,但希望能有所帮助,干杯。


推荐阅读