windows - 制作一个在 WinPython 命令提示符中运行 commando 的批处理文件

标签 windows batch-file python-3.x

如何编写一个批处理文件来从 WinPython 命令提示符中执行突击队“python my_program.py”?不是来自 cmd.exe!

最佳答案

试一试:

"Portable or not, the choice is yours!" 部分它描述了如何“将您的发行版注册到 Windows”。
当您在 Windows 中注册 WinPython 时,您可以双击文件并执行。这也意味着您只需在命令提示符(cmd.exe 和其他)中键入文件名作为 my_program.py 即可运行该文件。注意:在 linux 系统上,您可以编写例如 python my_program.py 来告诉 python 运行该程序。相比之下,在 Windows 上,一旦您注册了您的扩展程序,您就可以运行它而无需告诉窗口要使用哪个解释器。

如果要为my_program.py使用特定的解释器,需要指定解释器的路径。
我将 WinPython 安装在 C:\WinPython-64bit-3.4.3.3,
所以我的命令是 C:\WinPython-64bit-3.4.3.3\scripts\python.bat my_program.py.
我还安装了 Python 3,所以我的 python.exe 路径是 C:\Python34\python.exe
我的命令是 C:\Python34\python.exe my_program.py

试一试,如果不行告诉我。

关于windows - 制作一个在 WinPython 命令提示符中运行 commando 的批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31113114/

相关文章:

.net - 第一次从代码访问windows文件夹

windows - 删除目录中与某些文件扩展名不匹配的文件

windows - 批量写入文件

python - TF2.2 : Loading a Saved Model from tensorflow_hub failed with `AttributeError: ' _UserObject' object has no attribute 'summary' `

python - 捕获不包含牛津逗号的单词列表

windows - 将已执行进程的输出定向到当前 cmd

c# - 在 C# 中运行命令行参数

batch-file - 批处理文件 : <part of command line> was unexpected at this time

batch-file - 如何让 %random% 显示负结果?

python - 为什么我不能使用带星号的表达式?