gpt4 book ai didi

Python/Django shell 无法启动

转载 作者:太空狗 更新时间:2023-10-29 21:19:06 26 4
gpt4 key购买 nike

Django 的一大特色是您可以打开一个 python 解释器设置以用于您的项目。这可用于分析数据库中的对象,并允许在您的项目上执行任何 python 命令。我发现它对 Django 开发至关重要。使用此命令在项目目录中调用它:

$ python manage.py shell

我刚刚开始开发一个新项目,但出于某种原因,shell 无法正常工作。我在网上查看了错误,但没有找到任何东西。对于此错误的任何帮助,我将不胜感激:


Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager
utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.6/site-packages/django/core/management/commands/shell.py", line 29, in handle_noargs
shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'

预先感谢您的帮助!

最佳答案

IPython 似乎不知何故安装错误。尝试使用以下命令启动 shell:

./manage.py shell --plain

启动标准 Python shell,而不是 IPython。如果可行,则尝试完全删除 IPython 并重新安装。

关于Python/Django shell 无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2078059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com