从 Windows 命令行运行 Python [英] Running Python from the Windows Command Line

查看:47
本文介绍了从 Windows 命令行运行 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 Windows 命令行 (cmd.exe) 运行 Python 文件,以便我不必每次都重新输入代码?

How do I run a Python file from the Windows Command Line (cmd.exe) so that I won't have to re-enter the code each time?

推荐答案

难道您不是简单地将 Python 代码保存到文件中,然后使用 Python 执行该文件吗?

Wouldn't you simply save your Python code into a file, and then execute that file using Python?

将您的代码保存到名为 Test.py 的文件中.

Save your code into a file called Test.py.

然后运行它?

$ C:\Python24\Python.exe C:\Temp\Test.py

这篇关于从 Windows 命令行运行 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆