简体   繁体   English

无法使用Python的manage.py makemigrations迁移数据库

[英]Not able to migrate DB, using Python's manage.py makemigrations

I want to migrate a model in the database, so I am using this command in my active environment: 我想在数据库中迁移模型,所以我在我的活动环境中使用此命令:

python manage.py makemigrations

But it gives me this error: 但它给了我这个错误:

File "manage.py", line 14
  ) from exc
       ^
SyntaxError: invalid syntax

What is the solution for this problem? 这个问题的解决方案是什么?

That is a Python 3 manage.py file, so you might just need to type python3 manage.py makemigrations , or you might need to install python3 . 这是一个Python 3 manage.py文件,因此您可能只需要键入python3 manage.py makemigrations ,或者您可能需要安装python3

If you are using virtual environments then you probably just need to run the bin/activate of your virtual environment. 如果您使用的是虚拟环境,那么您可能只需要运行虚拟环境的bin/activate

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

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