Django 1.9 Compilation Error

I created virtualenv and loaded Django with the following commands:

virtualenv tester source tester/bin/activate pip install django 

and below answer:

 Downloading/unpacking django Downloading Django-1.9-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded Installing collected packages: django Compiling /home/romaan/workspacepy/tester/build/django/django/conf/app_template/apps.py ... File "/home/romaan/workspacepy/tester/build/django/django/conf/app_template/apps.py", line 4 class {{ camel_case_app_name }}Config(AppConfig): ^ SyntaxError: invalid syntax Compiling /home/romaan/workspacepy/tester/build/django/django/conf/app_template/models.py ... File "/home/romaan/workspacepy/tester/build/django/django/conf/app_template/models.py", line 1 {{ unicode_literals }}from django.db import models ^ SyntaxError: invalid syntax Successfully installed django 

Please help me get rid of this error. That's all, although he says that django has been successfully installed, I am fond of understanding and get rid of this syntax error.

Or Should I just wait for bug fixes?

+5
source share
4 answers

This looks like the setuptools issue mentioned in the Django 1.9 release notes: https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x

Try running pip install --upgrade pip before running pip install django

+16
source

Those cannot and should not be fixed. These are template files that are replaced during project creation and are not valid for Python syntax. They should not be compiled during installation, but rather during project creation.

+1
source

pip install -U pip works fine but didn't fix my problem

  • I got the same message when trying pip install django .
  • I was thinking of trying the previous version, so I tried pip install django-1.9 .
  • He said: "The real name of the Django-1.9 requirement is django-503."
  • So pip install Django-503 worked fine for me.
0
source

These steps worked for me:

 $ sudo python -m pip install --upgrade --force setuptools $ sudo python -m pip install --upgrade --force pip $ sudo pip install django==1.9 
0
source

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


All Articles