简体   繁体   English

使用 Windows 终端而不是命令提示符运行 python.exe

[英]Run python.exe with Windows Terminal instead of Command Prompt

Recently I am playing around with Rich.最近我在和 Rich 玩。 It's really helpful while debugging and tracking code running progress.这在调试和跟踪代码运行进度时非常有用。 However, if I use task scheduler to auto-run python script, it will open command prompt to run the script instead of others like Window PowerShell.但是,如果我使用任务调度程序自动运行 python 脚本,它将打开命令提示符来运行脚本,而不是像 Window PowerShell 这样的其他脚本。 All the output from Rich will not show in command prompt. Rich 的所有输出都不会显示在命令提示符中。 Is there anyway to set python.exe run by other instead of command prompt?无论如何设置由其他而不是命令提示符运行的python.exe?

My batch file looks like this:我的批处理文件如下所示:

"C:\\Python39\\python.exe" "C:\\PATH\\TO\\PyScript.py" "C:\\Python39\\python.exe" "C:\\PATH\\TO\\PyScript.py"

在 Windows 终端 PowerShell 中使用 Rich

在命令提示符中

Yes, there is a way to do this.是的,有一种方法可以做到这一点。

Just use this command:只需使用此命令:

powershell.exe "C:\Python39\python.exe C:\PATH\TO\PyScript.py"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Python在Windows命令提示符中运行.exe文件 - Use Python to run a .exe file in Windows Command Prompt Python help('modules')命令在IDLE(idle.pyw)中引发WindowsError,但没有命令行提示符(python.exe) - Python help('modules') command throws WindowsError in IDLE (idle.pyw) but not command line prompt (python.exe) 无法运行包含剧作家的python.exe - Unable to run python.exe containing playwright 为什么 Windows 看不到 python.exe? - Why does Windows not see python.exe? 在运行时获取python.exe路径 - Getting python.exe path at run time 我可以在 Windows 的命令提示符下运行 python,但无法在 atom 编辑器的终端中运行它 - I am able to run python on my command prompt of windows but unable to run it in terminal of atom editor 当 python.exe 设置为“以管理员身份运行”时,在 Windows 中运行 python 脚本会给出“无法使用...创建进程” - Running a python script in Windows gives "Unable to Create Process Using ..." when python.exe set to 'run as administrator' python.exe 在我运行 python **.py 时崩溃,来自 windows ZDFFF0A7FA1A55C8C1A4966C19FDA445 - python.exe was crashed when I run python **.py from windows cmd Windows 10 python.exe 在命令行中既不运行也不给出错误 - Windows 10 python.exe neither runs nor gives error in command line 模块可以通过anaconda提示符导入,但不能通过python.exe - Module can import through anaconda prompt, but not through python.exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM