python manage.py graph_models -a -g -o myapp_models.png
我收到此错误:
CommandError: Neither pygraphviz nor pydot could be found to generate the image
当我安装pygraphviz时出现此错误:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django_extensions/management/utils.py", line 57, in inner
ret = func(self, *args, **kwargs)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django_extensions/management/commands/graph_models.py", line 89, in handle
self.render_output_pydot(dotdata, **options)
File "/home/shaifali/.virtualenvs/drf-auth/lib/python3.5/site-packages/django_extensions/management/commands/graph_models.py", line 152, in render_output_pydot
graph.write(output_file, format=format)
AttributeError: 'list' object has no attribute 'write'
如上所述django-extensions docs,当我尝试安装pyparsing == 1.5.7时,我收到以下错误:
Collecting pyparsing==1.5.7
Using cached pyparsing-1.5.7.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-1_hzke3p/pyparsing/setup.py", line 9, in <module>
from pyparsing import __version__ as pyparsing_version
File "/tmp/pip-build-1_hzke3p/pyparsing/pyparsing.py", line 855
except ParseBaseException, err: ^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1_hzke3p/pyparsing/
我已经安装了没有任何版本的pyparsing和pydot,我得到了与pygraphviz相同的错误:
AttributeError: 'list' object has no attribute 'write'