如何在Ubuntu的可执行程序中转换python程序.py? [英] How transform a python program .py in an executable program in Ubuntu?
本文介绍了如何在Ubuntu的可执行程序中转换python程序.py?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的python程序,并且我希望该程序的可执行版本(对于Ubuntu Linux)避免在终端中使用python myprogram.py
运行它.
I have a simple python program and I want an executable version (for Ubuntu Linux) of this program to avoid running it in the terminal with python myprogram.py
.
我该怎么做?
推荐答案
没有必要.您可以使用
chmod +x filename
确保第一行中有shebang行:
Make sure it has a shebang line in the first line:
#!/usr/bin/env python
并且您的linux应该能够理解该文件必须用python解释.然后可以将其执行"为
And your linux should be able to understand that this file must be interpreted with python. It can then be 'executed' as
./myprogram.py
这篇关于如何在Ubuntu的可执行程序中转换python程序.py?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文