Export runnable program from python eclipse project on ubuntu

半世苍凉 提交于 2019-12-24 08:28:28

问题


It is my first time to use python, so i doing a simple program with a simple UI. I am using eclipse with PyDev as an IDE.

I know in JAVA a to export a runnable program we use .jar files, but what works for python and how to do it in eclipse on ubuntu ?

So if any explanation with some details or a useful link, i will be grateful.

Thanks,

Samer


回答1:


Easiest way on windows is py2exe. If you're using Mac, check out py2app. If you're in a Linux/Unix environment, I'm a bit less familiar with how to create a standalone, but a simple shell script like

python script_name.py

should do the trick. Call it launch.sh or something and set the permissions to rwx--x--x or whatever fits your security paradigm and you should be good.

Note, none of those actually uses the Eclipse IDE itself, but they aren't very difficult to use, and all you need to know if the folder where Eclipse is dumping your stuff (which you want to know for backup/verson control purposes anyway).




回答2:


Eclipse/PyDev has nothing really specific for that... still, Python has tools which can automate that work to bundle a python executable along your code to execute it in a client.

My preferred tool for that is cx_Freeze: http://cx-freeze.sourceforge.net (mostly because it's cross-platform), although there are many options (py2exe, py2app, pyinstaller...).

If you however wanted to distribute the code for other developers, you'd want to distribute to PyPi: https://pypi.python.org/pypi, creating a setup.py to categorize your content and say what needs to be distributed and uploaded to PyPi so that other devs can install it with pip.



来源:https://stackoverflow.com/questions/6721882/export-runnable-program-from-python-eclipse-project-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!