问题描述
我从命令行运行pip,尝试安装pydot,因为Django的django扩展名需要它来生成UML类图
I'm running pip from the command line, trying to install pydot because Django's django-extensions needs it to generate UML class diagrams
当我运行命令pip install pydot
时,它给了我这个错误:
When I run the command pip install pydot
, it gives me this error:
Collecting pydot
Using cached pydot-1.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\[me]\AppData\Local\Temp\pip-build-uscu27_d\pydot\setup.py
", line 5
except ImportError, excp:
^
SyntaxError: invalid syntax
easy_install pydot
也会发生相同的错误.
The same error happens with easy_install pydot
.
看起来正确的语法应该是except ImportError as excp
,但是我不知道该怎么办.我正在使用的Python版本是3.4.3.我必须降级Python版本才能使其正常工作,还是有其他方法?
Looks like the correct syntax would be except ImportError as excp
, but I don't know what to do about this. The version of Python I'm using is 3.4.3. Do I have to downgrade my version of Python to get this to work, or is there some other way?
推荐答案
此错误是由于python2的exception
旧语法引起的.
This error is due to the old exception
syntax of python2.
由于pydot
似乎是一个非常老的库并且不再维护,因此我建议您对其进行分叉并自行纠正此错误.
Since pydot
seems to be a very old library and no longer maintained, I'd suggest forking it and correct this error yourself.
这篇关于pip install pydot引发SyntaxError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!