首页 > 解决方案 > 由于 manage.py 文件中的错误,无法运行 django 项目

问题描述

我正在做 django 项目。我的python版本是2.7.15,django版本是1.11.29。当我试图执行

 python manage.py runserver

我收到如下错误 -

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

为了解决这个问题,我从 exc中删除并再次运行,然后它会引发如下错误 -

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 13, in main
    "Couldn't import Django. Are you sure it's installed and "
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

可能是stackoverflow本身已经有类似的问题,但这些解决方案在我的情况下不起作用,因此我问我的问题。请建议我如何解决它?提前致谢。

标签: djangopython-2.7

解决方案


推荐阅读