python - 使用 python 3.3 在 Django 1.9 中导入 WeakMethod 错误

标签 python django python-3.x django-views

我在 python 3.3 中使用 django 1.9.1。 运行 runserver 时出现以下错误

File "/home/virtualenv/python3.3.5/lib/python3.3/site-packages/django/dispatch/__init__.py", line 9, in <module>
from django.dispatch.dispatcher import Signal, receiver # NOQA
File "/home/virtualenv/python3.3.5/lib/python3.3/site-packages/django/dispatch/dispatcher.py", line 14, in <module>
from weakref import WeakMethod
ImportError: cannot import name WeakMethod

正如我在阅读 Weakref 的 WeakMethod 已在 python 3.4 中引入,而它在 python 3.3 的 weakref 中不存在。

有关如何使用 python 3.3 修复相同错误的任何建议。

最佳答案

Django 1.9.x 不支持 Python 3.3:

https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django

Typically, we will support a Python version up to and including the first Django LTS release whose security support ends after security support for that version of Python ends. For example, Python 3.3 security support ends September 2017 and Django 1.8 LTS security support ends April 2018. Therefore Django 1.8 is the last version to support Python 3.3.

您可以降级到 Django 1.8 或将您的 Python 解释器升级到 3.4 或更高版本。

关于python - 使用 python 3.3 在 Django 1.9 中导入 WeakMethod 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35284560/

相关文章:

python - Mac OS 10.9 (Mavericks) 卸载了 Django

python - Celeryd 运行多个守护进程

python - 将列表的元素转换为二进制

python - 从现有数据库编码生成 python 的工具?

python - Scrapy 无法正确收集电子邮件

django - 如何在 django 中创建模板标签并使用 Form?

python - 使用 REGEX 读取财务报表

python - 如何使一个模块可以被其他模块访问

java - 什么是 Jython,它是否有用?

python - 在 Django 中获取模型表单的保存对象?