Failed to install Django: the command "python setup.py egg_info" failed with error code 1 in / tmp / pip-build-rcF9a5 / Django /

I am trying to install Django through the command line. I used pip install Djangobut received this message:

Collecting Django
  Using cached `Django-2.0.tar.gz`

Complete the output of the command python setup.py egg_info:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-rcF9a5/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 **/tmp/pip-build-rcF9a5/Django/**

How to fix it?

+4
source share
2 answers

Pip is trying to install Django 2.0, which is incompatible with Python 2. You can install the latest version 1.11.x using

pip install "Django<2"

Theres an open issue in Django tracker in order to make pip the correct version.

If you are just starting out with Django, it would be much better to use Python 3 because 1.11 is the latest version to support Python 2.

+7
source

Django 2.0 python 3. - . python 3 (python3 -m venv myvenv) Django 2.0. pip python 3 2.

+1

Source: https://habr.com/ru/post/1690353/


All Articles