简体   繁体   English

Mac OS Django-admin startproject mysite 收到语法错误

[英]Mac OS Django-admin startproject mysite receives syntax error

I'm trying to follow the tutorial on https://docs.djangoproject.com/en/3.1/intro/tutorial01/ and have made it to the step where you are supposed to run django-admin startproject mysite in the command line.我正在尝试按照https://docs.djangoproject.com/en/3.1/intro/tutorial01/上的教程进行操作,并已进入您应该在命令行中运行django-admin startproject mysite的步骤。

I have tried running the followings:我试过运行以下内容:

django-admin startproject mysite
django-admin.py startproject mysite
django-admin startproject.py mysite
$ django-admin startproject mysite

and

$ django-admin.py startproject mysite

and all of them receive他们都收到

SyntaxError: invalid syntax

either with a ^ under the "t" in "startproject" or under the $ when I've tried that.在“startproject”中的“t”下或在我尝试过的 $ 下带有^

I've searched through about ten different posts trying to figure out how to proceed, and none of the answers provided have worked for me.我搜索了大约十个不同的帖子,试图弄清楚如何继续,但提供的答案都没有对我有用。 They all continue to receive他们都继续收到

SyntaxError: invalid syntax

I would really appreciate any insight into why this is happening and how to fix it.我真的很感激任何关于为什么会发生这种情况以及如何解决它的见解。

What did you get as a response when you typed python -m django --version in terminal?当您在终端中输入python -m django --version时,您得到了什么响应?

Given that you have django installed properly, django-admin startproject *name of project* is the correct syntax.鉴于您已正确安装 django, django-admin startproject *name of project*是正确的语法。 (the first line you listed is correct). (您列出的第一行是正确的)。

Perhaps try to re-install django and try again.也许尝试重新安装 django 并重试。 You can access the docs for installing here您可以在此处访问安装文档

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

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