简体   繁体   English

如何从 vs 代码执行 python 终端到 cmd 或其他

[英]how to execute python terminal from vs code to cmd or other

I learn about python, so I run python code in visual studio code on windows by creating a folder consisting of files main.py and settings.json .我了解了 python,因此我在 windows 上的 Visual Studio 代码中运行 python 代码,方法是创建一个包含文件main.pysettings.json .

The results in the terminal have no errors, but I am confused about execute the results to cmd or other files to be given to the user without seeing my code.终端中的结果没有错误,但我很困惑在没有看到我的代码的情况下将结果执行到 cmd 或其他文件给用户。

In the terminal, navigate to the same folder your python file is located, and enter在终端中,导航到 python 文件所在的同一文件夹,然后输入

python main.py

Or, if you're not going to navigate to the folder, you can include the entire path like this或者,如果您不打算导航到该文件夹,您可以像这样包含整个路径

python C:/Users/User/Desktop/Folder/main.py

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

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