Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There are errors when I install django by git?

Tags:

python

django

I install django through :

git clone git://github.com/django/django.git

pip install -e django/

I use Ubuntu 16.04.

But some errors occur :

Obtaining file:///home/leo/django
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/leo/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 60, 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 /home/leo/django/

How to fix this ? Thank you.

like image 206
yensheng Avatar asked Feb 13 '17 03:02

yensheng


People also ask

Does Python 3.7 support Django?

Python compatibility Django 3.0 supports Python 3.6, 3.7, 3.8, and 3.9 (as of 3.0. 11). We highly recommend and only officially support the latest release of each series.

Can I PIP install Django?

Django can be installed easily using pip . In the command prompt, execute the following command: pip install django . This will download and install Django. After the installation has completed, you can verify your Django installation by executing django-admin --version in the command prompt.

Do I need to install Django in every virtual environment?

Basically Yes, you'll need to install django for each project when you are using virtual environment.


2 Answers

The last Django version does not support python 2.7.

If you really want to use python 2.7 and also use Django you should install a previous Django version.

The latest supported is: 1.11

Therefore, just run:

pip install django==1.11
like image 152
george Avatar answered Oct 29 '22 02:10

george


This because django version you have needs python3 interpreter. so try to run the same command using pip3

To install pip3 sudo apt-get -y install python3-pip

then run

pip3 install -e django/

like image 24
vimal1083 Avatar answered Oct 29 '22 01:10

vimal1083