Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
执行python manage.py runserver时,cmp错误中超出了最大递归深度_Python_Django - Fatal编程技术网

执行python manage.py runserver时,cmp错误中超出了最大递归深度

执行python manage.py runserver时,cmp错误中超出了最大递归深度,python,django,Python,Django,我正试图在我的mac上安装Django。当我运行命令python manage.py runserver时。我得到错误RuntimeError:cmp中超过了最大递归深度。我已将错误消息粘贴到下面。我甚至将setrecursion限制提高到2000,并尝试了一下,但没有成功。非常感谢您对修复此问题的任何帮助 正在验证模型 Unhandled exception in thread started by <bound method Command.inner_run of <djang

我正试图在我的mac上安装Django。当我运行命令python manage.py runserver时。我得到错误RuntimeError:cmp中超过了最大递归深度。我已将错误消息粘贴到下面。我甚至将setrecursion限制提高到2000,并尝试了一下,但没有成功。非常感谢您对修复此问题的任何帮助

正在验证模型

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1087f4a10>>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
    self._populate()
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 72, in _populate
    self.load_app(app_name, True)
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 96, in load_app
    models = import_module('.models', app_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/django/contrib/auth/models.py", line 370, in <module>
    class AbstractUser(AbstractBaseUser, PermissionsMixin):
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 213, in __new__
    new_class.add_to_class(field.name, copy.deepcopy(field))
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 265, in add_to_class
    value.contribute_to_class(cls, name)
  File "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", line 257, in contribute_to_class
    cls._meta.add_field(self)
  File "/Library/Python/2.7/site-packages/django/db/models/options.py", line 179, in add_field
    self.local_fields.insert(bisect(self.local_fields, field), field)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py", line 56, in <lambda>
    '__lt__': [('__gt__', lambda self, other: other < self),
RuntimeError: maximum recursion depth exceeded in cmp
由启动的线程中未处理的异常 回溯(最近一次呼叫最后一次): 文件“/Library/Python/2.7/site packages/django/core/management/commands/runserver.py”,第92行,在内部运行 self.validate(display\u num\u errors=True) 文件“/Library/Python/2.7/site packages/django/core/management/base.py”,第280行,在validate中 num\u errors=get\u validation\u errors(s,app) 文件“/Library/Python/2.7/site packages/django/core/management/validation.py”,第35行,在get\u validation\u errors中 对于get_app_errors()中的(app_name,error)。项() 文件“/Library/Python/2.7/site packages/django/db/models/load.py”,第166行,在get\u app\u errors中 自我.() 文件“/Library/Python/2.7/site packages/django/db/models/load.py”,第72行,在 self.load\u应用程序(应用程序名称,True) 文件“/Library/Python/2.7/site packages/django/db/models/load.py”,第96行,在load_应用程序中 模型=导入模块('.models',应用程序名称) 文件“/Library/Python/2.7/site packages/django/utils/importlib.py”,第35行,在导入模块中 __导入(名称) 文件“/Library/Python/2.7/site packages/django/contrib/auth/models.py”,第370行,在 类AbstractUser(AbstractBaseUser,PermissionsMixin): 文件“/Library/Python/2.7/site packages/django/db/models/base.py”,第213行,在新的__ 新建_类。将_添加到_类(field.name,copy.deepcopy(field)) 文件“/Library/Python/2.7/site packages/django/db/models/base.py”,第265行,在add_to_类中 值。贡献给类(cls,名称) 文件“/Library/Python/2.7/site packages/django/db/models/fields/_init__.py”,第257行,在contribution_to_类中 cls.\u meta.add\u字段(self) 文件“/Library/Python/2.7/site packages/django/db/models/options.py”,第179行,在add_字段中 self.local\u fields.insert(对分(self.local\u fields,field),field) 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/functools.py”,第56行,在 “\uuult\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu, 运行时错误:cmp中超过最大递归深度
在启动一个没有任何编码的新项目后,我遇到了同样的问题

也有类似的帖子

在我的例子中,我只需卸载django,然后再次安装

sudo pip uninstall django

sudo pip install django
一个警告。我在新的终端上执行了此操作。安装后,我返回到终端,在那里我得到了错误并运行“python manage.py runserver”,我仍然得到相同的错误,但在新的终端窗口上,它没有给我错误


希望这对您有用。

您运行syncdb了吗?也许可以尝试使用sqllite来确保问题与mysqldb包无关?

如果您还没有,请尝试安装
python 2.7.5

在使用django版本1.5.1和python版本2.7.2时,我遇到了类似的问题。当我切换到2.7.5时,问题得到了解决

要在mac上运行python 2.7.5,请转到并下载系统的mac安装程序。安装后,转到system Applications文件夹的“python 2.7”子文件夹, 然后从命令行双击“更新Shell概要文件”以使用2.7.5

完成此操作后,在命令行中键入
python--version
,确认您正在使用2.7.5

希望有帮助!

    convert = {
    '__lt__': [('__gt__', lambda self, other: other < self),
               ('__le__', lambda self, other: not other < self),
               ('__ge__', lambda self, other: not self < other)],
    '__le__': [('__ge__', lambda self, other: other <= self),
               ('__lt__', lambda self, other: not other <= self),
               ('__gt__', lambda self, other: not self <= other)],
    '__gt__': [('__lt__', lambda self, other: other > self),
               ('__ge__', lambda self, other: not other > self),
               ('__le__', lambda self, other: not self > other)],
    '__ge__': [('__le__', lambda self, other: other >= self),
               ('__gt__', lambda self, other: not other >= self),
               ('__lt__', lambda self, other: not self >= other)]
}
    convert = {
    '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
               ('__le__', lambda self, other: self < other or self == other),
               ('__ge__', lambda self, other: not self < other)],
    '__le__': [('__ge__', lambda self, other: not self <= other or self == other),
               ('__lt__', lambda self, other: self <= other and not self == other),
               ('__gt__', lambda self, other: not self <= other)],
    '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
               ('__ge__', lambda self, other: self > other or self == other),
               ('__le__', lambda self, other: not self > other)],
    '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
               ('__gt__', lambda self, other: self >= other and not self == other),
               ('__lt__', lambda self, other: not self >= other)]
}
$ python manage.py shell
$ python