我创建了一个虚拟环境,我命名为"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:UsershpAppDataLocalProgramsPythonPython36djflibimportlib__init__.py", line 25
try:python manage.py makemigrations
^
SyntaxError: invalid syntax
有人可以帮助解决错误吗?
你(不小心?(粘贴了
python manage.py makemigrations
在try:
之后的文件中。
删除它,你应该是黄金 - 无论如何,你应该总是能够从头开始重新创建你的虚拟环境。