如何在 Windows 命令提示符下运行 python 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39462632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to run python files in windows command prompt?
提问by Abdullah Bilal
回答by Benjamin
First set path of python
https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows
首先设置https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows 的路径python
and run python
file
并运行python
文件
python filename.py
python filename.py
command line argument with python
python的命令行参数
python filename.py command-line argument
python filename.py command-line argument
回答by Matu
回答by V.Khakhil
First go to the directory where your python script is present by using-
首先使用 - 转到您的python脚本所在的目录
cd path/to/directory
then simply do:
然后简单地做:
python file_name.py