python3 django-admin语法错误

时间:2018-08-08 13:13:27

标签: django django-admin

尝试学习python / django。 在安装了所有零碎的组件后收到此错误(请参见列表)。请指出正确的方向。谢谢!

$ django-admin startproject test1
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/django-admin", line 11, in <module>
    load_entry_point('Django==2.1', 'console_scripts', 'django-admin')()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2627, in load_entry_point
    return ep.load()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2287, in load
    return self.resolve()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2293, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 11, in <module>
    from django.conf import settings
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/conf/__init__.py", line 18, in <module>
    from django.utils.functional import LazyObject, empty
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/utils/functional.py", line 12
    return _curried_func(*args, *moreargs, **{**kwargs, **morekwargs})
                                ^
SyntaxError: invalid syntax

Python 3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 14:18:20) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())

2.1

1 个答案:

答案 0 :(得分:0)

您使用的是Python 3.5的Alpha版本-将Python更新到最新的稳定版3.5。