简体   繁体   English

为什么这个批处理脚本没有启动我的 python 程序?

[英]Why is this batch script not starting up my python program?

It's a simple script and is supposed to start my python program in the same directory.这是一个简单的脚本,应该在同一目录中启动我的 python 程序。 However, it just runs and closes in a blink.但是,它只是运行并眨眼之间关闭。

activate base
python CustomGUI.pyw
pause

Apparently, it's the activate base command which is being an issue.显然,这是activate base命令的问题。 The command window just closes without activating the base environment.命令窗口只是关闭而不激活基本环境。

For running python program using virtualenv you don't need to activate it.要使用virtualenv运行 python 程序,您不需要激活它。 You can directly use interpreter in the environment.您可以直接在环境中使用解释器。

run_gui.bat

C:\path\to\env\scripts\python CustomGUI.pyw
Pause

Will work just fine.会工作得很好。 For Windows 10 with Anaconda3 and username “jsmith”– the path will be C:\\Users\\jsmith\\Anaconda3\\python对于带有 Anaconda3 和用户名“jsmith”的 Windows 10——路径将是C:\\Users\\jsmith\\Anaconda3\\python

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM