2017-02-13 1 views
16

ich installieren django durch:Es gibt Fehler, wenn ich Django von Git installieren?

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

-e django installieren pip/

verwende ich Ubuntu 16.04.

Aber einige Fehler auftreten:

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/ 

Wie dieses Problem beheben? Danke.

+1

Warum sind Sie es von git Installation und nicht mit 'pip django' installieren? Es scheint, als ob Sie versuchen, es auf Python 2 zu installieren, während die neueste Entwicklungsversion von Django Python 3 erfordert. – kichik

+0

ja, "pip install django" kann mein Problem beheben. Aber ich weiß einfach nicht, warum dieses Problem auftritt? – yensheng

+4

Weil Sie versuchen, es auf Python 2 zu installieren, aber die neueste Version von Django erfordert Python 3. – kichik

Antwort

16

Dies, weil Django-Version benötigen Sie python3 Interpreter. so versuchen, den gleichen Befehl pip3

zu installieren pip3 sudo apt-get -y install python3-pip

dann laufen

pip3 install -e django/

+13

Django 2.0 wurde im Dezember 2017 veröffentlicht. Für Leute, die Python 2.7 verwenden, können Sie eine ältere Version von Django installieren mit "pip install django == 1.11.8" Gehen Sie zu https://www.djangoproject.com/download/, um zu überprüfen die neueste Release-Versionsnummer. – TimSC

38

Die letzte Django Version unterstützt Python 2.7 nicht ausgeführt werden.

Wenn Sie wirklich Python 2.7 verwenden und auch Django verwenden möchten, sollten Sie eine vorherige Django-Version installieren.

Die neueste unterstützt: 1,11

daher nur laufen:

pip install django==1.11 
+0

Dies ist keine echte Antwort und es ist überall für diese Art von Fehler! OP braucht eine Möglichkeit, django 2 nicht eine ältere Version zu installieren –

+1

Alex Wer hat dir gesagt, dass er Django 2 installieren möchte? Ich zweifle an deiner Argumentation. – george

+1

Mein Name ist auch Alex und ich schäme mich für Alex 'Ausbruch. Ihre Antwort hat mir geholfen, danke. Ich brauche Python 2 wegen einiger spezialisierter Pakete, auf die ich angewiesen bin. – a20

-2
Right > c:\Python27\Scripts>pip install django==1.11 
Wrong > c:\Python27\Scripts>pip2.7 install django 

c:\Python27\Scripts>pip2.7 install django 
Collecting django 
    Using cached Django-2.0.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "c:\users\shyv\appdata\local\temp\pip-build-idpp6j\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 c:\users\shyv\appdata\local\temp\pip-build-idpp6j\django\ 

c:\Python27\Scripts>pip install django==1.11 
Collecting django==1.11 
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cau 
    SNIMissingWarning 
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL co 
    InsecurePlatformWarning 
    Downloading Django-1.11-py2.py3-none-any.whl (6.9MB) 
    100% |################################| 6.9MB 108kB/s 
Collecting pytz (from django==1.11) 
    Downloading pytz-2017.3-py2.py3-none-any.whl (511kB) 
    100% |################################| 512kB 922kB/s 
Installing collected packages: pytz, django 
Successfully installed django-1.11 pytz-2017.3 
Verwandte Themen