我正在遵循Django教程https://docs.djangoproject.com/es/1.10/intro/tutorial01/
我创建了一个“ mysite”虚拟项目(我的第一个项目),并尝试对其进行测试而未对其进行更改。
django-admin startproject mysite
cd mysite
python manage.py runserver
File "manage.py", line 14
) from exc
^
SyntaxError: invalid syntax
我在系统本身生成的文件上收到SyntaxError。而且我似乎找不到其他遇到过同样问题的人。
如果可能有用,我将添加一些设置数据
$ vpython --version
Python 2.7.12
$ pip --version
pip 9.0.1 from /home/frank/.local/lib/python2.7/site-packages (python 2.7)
$ python -m django --version
1.10.6
有人能帮帮我吗?
更新:添加自动生成的manage.py的内容
cat manage.py
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)