【问题标题】:django-shortcuts command prompt error 'C:\Program' is not recognized as an internal or external command, operable program or batch filedjango-shortcuts 命令提示错误 'C:\Program' 不是内部或外部命令、可运行程序或批处理文件
【发布时间】:2019-04-25 22:32:57
【问题描述】:

尝试从 django 快捷方式 https://github.com/jgorset/django-shortcuts 运行“django r”命令

收到错误'C:\Program' is not recognized as an internal or external command, operable program or batch file

任何想法如何解决这个问题? 发现一些具有相同错误“C:\Program”错误的问题。不确定它对我的情况有何帮助。 Command Prompt Error 'C:\Program' is not recognized as an internal or external command, operable program or batch file

【问题讨论】:

    标签: django command-line


    【解决方案1】:

    此答案基于假设,但我希望它对您有所帮助。

    我认为您已将 Python 安装在您计算机上的 C:\Programs Files 之类的目录中。在 django-shortcuts 中,python 直接在命令行中使用sys.executable 调用(here),Windows 调用第一部分直到空格作为可执行文件。 你有不同的方法来解决这个问题,包括:

    • 使用'"%s"' % sys.executable
    • %(python)s 更改为"%(python)s"
    • 在另一个目录中重新安装 Python,路径中没有空格 ...

    【讨论】:

    • 刚刚尝试了您提出的第二种方法,它有效,服务器已启动并运行!谢谢!
    • 如果你没问题,别忘了验证答案
    猜你喜欢
    • 2014-09-14
    • 2022-10-07
    • 1970-01-01
    • 2023-03-27
    • 2021-04-25
    • 2011-09-06
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多