,所以我正在Django中的此测试应用程序,我想通过Python Shell向我的SQL表添加一些数据。我从CMD
运行以下命令λ python manage.py shell
给我以下输出:
Traceback (most recent call last): File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv) File "C:Pythonlibsite-packagesdjangocoremanagement__init__.py", line 371, in execute_from_command_line
utility.execute() File "C:Pythonlibsite-packagesdjangocoremanagement__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "C:Pythonlibsite-packagesdjangocoremanagementbase.py", line 288, in run_from_argv
self.execute(*args, **cmd_options) File "C:Pythonlibsite-packagesdjangocoremanagementbase.py", line 335, in execute
output = self.handle(*args, **options) File "C:Pythonlibsite-packagesdjangocoremanagementcommandsshell.py", line 99, in handle
return getattr(self, shell)(options) File "C:Pythonlibsite-packagesdjangocoremanagementcommandsshell.py", line 35, in ipython
from IPython import start_ipython File "C:Pythonlibsite-packagesIPython__init__.py", line 55, in <module>
from .terminal.embed import embed File "C:Pythonlibsite-packagesIPythonterminalembed.py", line 15, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell File "C:Pythonlibsite-packagesIPythoncoreinteractiveshell.py", line 109, in <module>
_assign_nodes = (ast.AugAssign, ast.AnnAssign, ast.Assign) AttributeError: module 'ast' has no attribute 'AnnAssign'
我正在使用Python 3和Django 2.0.3。
我自己尝试的一些事情:
我检查了ipython是否使用PIP进行了最新,我的数据库在SQL社区服务器上运行并且运行良好,并且Django服务器本身也没有问题运行。
编辑:我做了更多的挖掘AST是标准Python库的一部分。但是我没有发现我的python安装的任何问题,有什么想法吗?
edit2:尝试重新安装ipython,相同的追溯错误。
好的,所以我通过PIP完成了Django和MySqlClient的完整重新安装,从而解决了问题。我现在有django shell。