用pycharm创建django项目时报错该怎么解决?
用pycharm创建django项目时报错该怎么解决?
Error creating Django application: Error on python side. Exit code: 1, err: Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 338, in execute
django.setup()
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line 94, in create
module = import_module(entry)
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\__init__.py", line 4, in <module>
from django.contrib.admin.filters import (
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\filters.py", line 10, in <module>
from django.contrib.admin.options import IncorrectLookupParameters
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\options.py", line 12, in <module>
from django.contrib.admin import helpers, widgets
File "C:\Users\座山雕\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\widgets.py", line 151
'%s=%s' % (k, v) for k, v in params.items(),
^
SyntaxError: Generator expression must be parenthesized
out:
问题描述
用pycharm创建django项目时报错该怎么解决?
问题出现的平台版本及自己尝试过哪些方法
重装Django也没用
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
Error creating Django application: Error on python side. Exit code: 1, err: Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocoremanagement__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocoremanagement__init__.py", line 338, in execute
django.setup()
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjango__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangoappsregistry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangoappsconfig.py", line 94, in create
module = import_module(entry)
File "C:Users座山雕AppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocontribadmin__init__.py", line 4, in <module>
from django.contrib.admin.filters import (
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocontribadminfilters.py", line 10, in <module>
from django.contrib.admin.options import IncorrectLookupParameters
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocontribadminoptions.py", line 12, in <module>
from django.contrib.admin import helpers, widgets
File "C:Users座山雕AppDataLocalProgramsPythonPython37libsite-packagesdjangocontribadminwidgets.py", line 151
'%s=%s' % (k, v) for k, v in params.items(),
^
SyntaxError: Generator expression must be parenthesized
out:
你期待的结果是什么?实际看到的错误信息又是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的django跟python分别是什么版本?
django-1.11.16及以下的版本在使用python3.7解释器的时候会出现“Generator expression must be parenthesized”这个问题。
如果是上述版本问题,你可以升级一下django,到2.0以上,或者到1.11.17。