how to run python files in windows command prompt?

故事扮演 提交于 2020-01-03 06:42:11

问题


I want to run a python file in my command prompt but it does nothing. These are the screen shots of my program i am testing with and the output the command prompt gives me.


回答1:


First set path of python https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows

and run python file

python filename.py

command line argument with python

python filename.py command-line argument




回答2:


You have to install Python and add it to PATH on Windows. After that you can try:

python `C:/pathToFolder/prog.py`

or go to the files directory and execute:

python prog.py



回答3:


First go to the directory where your python script is present by using-

cd path/to/directory

then simply do:

python file_name.py


来源:https://stackoverflow.com/questions/39462632/how-to-run-python-files-in-windows-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!