使用Python3.3的Django 1.9中的Import WeakMethod错误

2024-03-29 06:08:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我将django1.9.1与python3.3一起使用。 运行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已经在python3.4中引入,而它在python3.3的weakref中并不存在。在

关于如何用Python3.3修复相同错误的任何建议。在


Tags: djangoinpyimporthomevirtualenvlibpackages
1条回答
网友
1楼 · 发布于 2024-03-29 06:08:40

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.

您可以降级到django1.8或将Python解释器升级到3.4或更高版本。在

相关问题 更多 >