Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

python 2.7 - Django 1.9 Compiling Error

I created a virtualenv and downloaded Django with the below commands:

virtualenv tester
source tester/bin/activate
pip install django

and below is the response:

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 to get rid of this error. All though it says Successfully installed django, I am keen on understanding and getting rid of this syntax error.

Or Should I just wait for the bug fix to happen?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 to run pip install --upgrade pip before running pip install django


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...