简体   繁体   English

如何从Web运行python脚本到终端

[英]How to run a python script from web into a terminal

我有很少的python脚本扫描网络,例如ping,tracert和我正在制作一个Web应用程序来执行此操作,现在我想知道是否有一种方法可以从web应用程序在cmd /终端上运行python脚本。

To run Python scripts with the python command, you need to open a command-line and type in the word python, or python3 if you have both versions, followed by the path to your script, just like this: 要使用python命令运行Python脚本,您需要打开命令行并键入单词python,如果您有两个版本,则输入python3,然后输入脚本的路径,如下所示:

$ python3 hello.py
Hello World!

If everything works okay, after you press Enter, you'll see the phrase Hello World! 如果一切正常,按Enter后,您将看到短语Hello World! on your screen. 在你的屏幕上。 That's it! 而已! You've just run your first Python script! 你刚刚运行了你的第一个Python脚本!

If this doesn't work right, maybe you'll need to check your system PATH, your Python installation, the way you created the hello.py script, the place where you saved it, and so on. 如果这不能正常工作,您可能需要检查系统PATH,Python安装,创建hello.py脚本的方式,保存位置等等。

This is the most basic and practical way to run Python scripts 这是运行Python脚本的最基本和最实用的方法

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

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