我正在尝试通过终端下载并安装Django。为此,我运行了这个命令:
sudo pip install Django
然而,这产生了以下错误:
Collecting Django
Downloading Django-2.0.tar.gz (8.0MB)
100% |████████████████████████████████| 8.0MB 121kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-Y1GrsP/Django/setup.py", line 32, in
<module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
@functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-build-Y1GrsP/Django/
答案 0 :(得分:6)
Django 2.0与小于3.4的Python版本不兼容
lru_cache()
是在Python 3.2中引入的,所以你使用的Python版本太旧了。
如果您需要支持Python 2.7,请尝试Django 1.11,因为这是支持它的最后一个版本:
pip install "django~=1.11.9"