简体   繁体   English

Django:无法运行django-admin.py

[英]Django: Cannot run django-admin.py

Django==1.7
flup==1.0.2
python==2.6
stevedore==0.15
virtualenv==1.11.6
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.1 

I try and run django-admin.py but I keep getting this bizzare syntax error, all on a fresh install of django.. 我尝试运行django-admin.py但是在全新安装的django上,我一直收到这个奇怪的语法错误。

File "/home/ibusdep1/.virtualenvs/ibus/bin/django-admin.py", line 2, in <module>
  from django.core import management
File "/home/ibusdep1/.virtualenvs/ibus/lib/python2.6/site-packages/django/core/management/__init__.py", line 68
  commands = {name: 'django.core' for name in find_commands(__path__[0])}
                                      ^
SyntaxError: invalid syntax

Django is installed in /.virtualenv/(projectname)/lib/python2.6/site-packages/Django and it is within my $PYTHONPATH. Django安装在/.virtualenv/(projectname)/lib/python2.6/site-packages/Django ,并且在我的$ PYTHONPATH中。

What could be throwing this syntax error? 什么会引发此语法错误?

Django 1.7 is not compatible with Python 2.6 Django 1.7与Python 2.6不兼容

Django 1.7 & 1.8 requires Python 2.7, 3.2, 3.3, or 3.4. Django 1.7和1.8需要Python 2.7、3.2、3.3或3.4。 See What Python version can I use with Django? 请参阅我可以在Django中使用哪个Python版本?

The error you see there is a dict comprehension, added in Python 3 & 2.7+. 您看到的错误是dict理解,已在Python 3和2.7+中添加。

Django 1.7 only supports Python 2.7 +, not Python 2.6 Django 1.7仅支持Python 2.7 +,不支持Python 2.6

https://docs.djangoproject.com/en/dev/releases/1.7/ https://docs.djangoproject.com/en/dev/releases/1.7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM