Python / Django shell将无法启动 [英] Python/Django shell won't start

查看:157
本文介绍了Python / Django shell将无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Django的一大优点就是可以打开一个python口译器来与您的项目一起使用。这可以用于分析数据库中的对象,并允许在项目中执行任何python命令。我发现Django的开发很重要。它使用以下命令在项目目录中调用:

One of the great features of Django is that you can open a python interpreter set-up for use with your project. This can be used to analyse objects in a database and allows any python commands to be executed on your project. I find it essential for Django development. It is invoked in the project directory using this command:

$ python manage.py shell

我刚刚开始开发一个新项目,由于某些原因,shell不起作用。我在网上查看错误,没有找到任何东西。我非常感谢您对此错误的任何帮助:

I have just started developing a new project and for some reason the shell does not work. I have had a look online for the error and not found anything. I would greatly appreciate any help on this error:


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:

It seems like IPython is installed wrongly somehow. Try starting the shell with:

./manage.py shell --plain

启动标准的Python shell,而不是IPython。如果这样工作,那么尝试完全删除IPython并重新安装它。

to start the standard Python shell, rather than IPython. If that works, then trying removing IPython completely and reinstalling it.

这篇关于Python / Django shell将无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆