无法通过终端下载Django [复制]

问题描述 投票:0回答:1

我试图通过终端下载并安装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/
python django pip
1个回答
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"
© www.soinside.com 2019 - 2024. All rights reserved.