[英]Can you execute python files without using the terminal on linux?
I was wondering if you can directly open them by clicking on something, etc. So you dont have to write the whole "cd (directory)" then "python (filename)".我想知道您是否可以通过单击某些内容等直接打开它们。因此您不必编写整个“cd(目录)”然后“python(文件名)”。 On Windows you can do this simply by double clicking the file, but I don't know for linux.
在 Windows 上,您只需双击文件即可执行此操作,但我不知道 linux。
Thanks in advance.提前致谢。
You can create a.desktop file that launches the program when you click on it.您可以创建一个 .desktop 文件,当您单击它时启动该程序。
An example desktop file would be:一个示例桌面文件是:
[Desktop Entry]
Name=Application Name
Exec=python /path/to/file.py
Icon=/path/to/icon
Terminal=true
Change Terminal=true
to Terminal=false
if you don't want it to launch a terminal session and only display the GUI (if there is a GUI).如果您不希望它启动终端 session 并仅显示 GUI(如果有 GUI),请将
Terminal=true
更改为Terminal=false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.