SyntaxError:生成器表达式必须加括号 [英] SyntaxError: Generator expression must be parenthesized
问题描述
我刚安装了django,安装后我创建了一个django项目,并尝试通过命令运行django服务器:
I just installed django and after installing that I created a django project and was trying to run django server by command:
python manage.py runserver
之后,我得到如下错误:
SyntaxError:Generator表达式必须加括号
After that I'am getting error as: SyntaxError: Generator expression must be parenthesized
推荐答案
TL; DR:将Django升级到1.11.17+或2.0 +
此错误是与 noreferrer> Python问题#32012 。从Python 3.7开始时,基于Django 1.11.16及更低版本的项目将引发此异常。 此问题的补丁已合并到Django 2.0和2.1分支中,并在以后进行了精选。放入 Django 1.11.17 。
This error is a known incompatibility related to Python issue #32012. Projects based on Django 1.11.16 and below will raise this exception when started with Python 3.7. A patch for this issue has been merged into Django 2.0 and 2.1 branches and cherry-picked later into Django 1.11.17.
注意: Django 1.11.17正式支持Python 3.7 及更高版本,包括任何2.x分支。
Note: Python 3.7 is officially supported by Django 1.11.17 and above, including any 2.x branch.
这篇关于SyntaxError:生成器表达式必须加括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!