激活django Web应用程序时出错

问题描述 投票:0回答:1

我创建了一个名为“f”的虚拟环境。它一直工作正常,直到昨天它给了我一个错误。

代码是:

import _imp  # Just the builtin component, NOT the full Python module
import sys

try:
    import _frozen_importlib as _bootstrap
except ImportError:
    from . import _bootstrap
    _bootstrap._setup(sys, _imp)
else:
    # importlib._bootstrap is the built-in import, ensure we don't create
    # a second copy of the module.
    _bootstrap.__name__ = 'importlib._bootstrap'
    _bootstrap.__package__ = 'importlib'
    try:python manage.py makemigrations

        _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
    except NameError:
        # __file__ is not guaranteed to be defined, e.g. if this code gets
        # frozen by a tool like cx_Freeze.
        pass
    sys.modules['importlib._bootstrap'] = _bootstrap

python manage.py运行服务器的结果是:

File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\importlib\__init__.py", line 25
    try:python manage.py makemigrations
                    ^
SyntaxError: invalid syntax

有人可以帮助解决错误吗?

python django pycharm
1个回答
2
投票

你(不小心?)粘贴了

python manage.py makemigrations

try:之后的那个文件中。

删除它,你应该是金色的 - 你应该始终能够从头开始重新创建你的virtualenv。

© www.soinside.com 2019 - 2024. All rights reserved.