是否将'DEBUG=1'命令添加到windows?

2024-06-16 11:32:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用kaki 使用kivy和python的库,但要使用它,您需要运行

DEBUG=1 python main.py

但我面临着这个错误

DEBUG=1 : The term 'DEBUG=1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ DEBUG=1 python main.py
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (DEBUG=1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


但是我可以找到关于如何将此命令添加到路径的任何源代码

我正在使用

python:3.7
视窗10

如果需要,我会添加任何信息


Tags: orofthepathnamepydebugis
1条回答
网友
1楼 · 发布于 2024-06-16 11:32:01

在PowerShell中,您可以写入将由子进程继承的环境变量,如下所示:

PS ~> $env:DEBUG = 1
PS ~> python main.py

或作为一行上的两个语句:

$env:DEBUG = 1; python main.py

Python现在将在解析DEBUG环境变量时获得值1

cmd.exe中,您可以使用set关键字:

C:\> set "DEBUG=1" && python main.py

相关问题 更多 >