简体   繁体   English

使用Windows命令行从Pycharm项目文件夹运行Python文件

[英]Running Python Files from Pycharm Project Folder with Windows Command Line

I have watched numerous tutorials on how to run Python files using the windows command line (CMD.exe), but in all of the tutorials the video makers were accessing PythonXX from Program Files and also their Python files from Program Files. 我看了很多关于如何使用Windows命令行(CMD.exe)运行Python文件的教程,但是在所有教程中,视频制作者都从Program Files访问PythonXX,还从Program Files访问其Python文件。 I use Pycharm and have my single Project Folder in my Documents library. 我使用Pycharm,并在我的文档库中拥有一个项目文件夹。 If possible I would like to run those files from the project folder. 如果可能的话,我想从项目文件夹中运行那些文件。 If not, though, is there any way to relocate a Pycharm Project Folder and Pycharm will still recognize it as where I store my files? 但是,如果没有,是否有任何方法可以重定位Pycharm项目文件夹,而Pycharm仍将其识别为我存储文件的位置?

Thanks! 谢谢!

EDIT: 编辑:

YES, I am aware that I can run my Python Files in Pycharm, but I would like to use windows CMD for full screen and so I can watch over it while I code. 是的,我知道我可以在Pycharm中运行我的Python文件,但是我想使用Windows CMD进行全屏显示,因此我可以在编写代码时监视它。

To get to a directory with cmd simply hold shift while right-clicking the Documents folder. 要使用cmd进入目录,只需在右键单击Documents文件夹时按住shift键即可。 You should get an option 您应该有一个选择

Open command window here

在此处输入图片说明

To run python files, enter into cmd: 要运行python文件,请输入cmd:

python filename.py

Modify this command to include arguments if necessary. 如有必要,修改此命令以包含参数。

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

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