how to compile a stand alone executable on linux? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: how to compile a stand alone executable on linux? (/thread-8872.html) |
how to compile a stand alone executable on linux? - JackDinn - Mar-10-2018 Iv made a few little programs that i use on my comp (Linux/Manjaro) but they all show up in the running process list as just "Python" , on windows i would just compile them with py2exe and they would run as .exe's and show as themselves under the process list. Iv tried pyinstaller but i cant get it to install/work? (see below). Also tried py_compile which does create a .pyc under __pycache__/ but it wont run with ./mycode.pyc and if i use pythpn mycode.pyc then it just shows up as a "python" process again instead on "mycode" or "mycode.pyc". It must be that i'm missing something really simple cos i'm a dumb ass noob but i cant figure it. P.S. i'm not really talking about making an installation package, i have not got that far yet on linux. pyinstaller problems (BASH CODE):- ❰greg❙~/PycharmProjects/octo-notifier-working❱✔≻ pyinstaller octo-notifier.py Traceback (most recent call last): File "/usr/bin/pyinstaller", line 6, in <module> from pkg_resources import load_entry_point File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3147, in <module> @_call_aside File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3131, in _call_aside f(*args, **kwargs) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3160, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in _build_master ws.require(__requires__) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 984, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 870, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'macholib>=1.8' distribution was not found and is required by PyInstallerSo i try to install aur/python-macholib 1.9-1 (BASH CODE):- Traceback (most recent call last): File "setup.py", line 532, in <module> use_setuptools() File "setup.py", line 433, in use_setuptools return _do_download(os.path.abspath(os.curdir)) File "setup.py", line 420, in _do_download tarball = download_setuptools(packagename, to_dir) File "setup.py", line 443, in download_setuptools chksum, url = get_pypi_src_download(packagename) File "setup.py", line 317, in get_pypi_src_download raise RuntimeError("Cannot determine downlink link for %s"%(package,)) RuntimeError: Cannot determine downlink link for setuptools ==> ERROR: A failure occurred in package_python2-macholib(). Aborting... ==> ERROR: Makepkg was unable to build python-macholib.Way out of my depth now RE: how to compile a stand alone executable on linux? - JackDinn - Mar-11-2018 well i got a bit further. I managed to install pyinstaller via pip but after compiling my app with it then and trying to run my app i get a nice new error? Quote:❰greg❙~/PycharmProjects/octo-notifier-working/pybuilder(git:master)❱✘≻ sudo pip install https://github.com/pyinstaller/pyinstaller/tarball/develop Quote:❰greg❙~/PycharmProjects/octo-notifier-working❱✔≻ sudo pyinstaller octo-notifier-messabout.py Quote:❰greg❙~/PycharmProjects/octo-notifier-working/build/octo-notifier-messabout❱✔≻ ./octo-notifier-messabout Dont ask why i'm using sudo for everything, if i dont use it i just get a load of :- Quote:ldd: warning: you do not have execution permission for `/usr/lib/libgcc_s.so.1' Im probably doing this all wrong but im following examples from the net (as best i can). I really need some help. RE: how to compile a stand alone executable on linux? - wavic - Mar-11-2018 Probably you need to install python-dev Read the error message. You are missing a library: libpython3.6m.so.1.0 RE: how to compile a stand alone executable on linux? - JackDinn - Mar-11-2018 I have libpython3.6m.so.1.0 installed. Quote:locate libpython3.6m.so.1.0 And i dont see any package called python-dev Quote:❰greg❙/usr❱✔≻ yaourt -Ss python-dev Checking the "dist" folder that was created when i run pyinstaller iv also found that it has already copied libpython3.6m.so.1.0 into it. So it definitely exists and has already used it? Quote:❰greg❙~/PycharmProjects/octo-notifier-working/dist/octo-notifier-messabout❱✔≻ ls -la libpy* RE: how to compile a stand alone executable on linux? - JackDinn - Mar-11-2018 I have been advised to try out Nuitka and it works like a charm so for now i shall go with that. Thank you all. What is Nuitka The TL;DR ... Nuitka is a Python compiler. It's fully compatible with Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and 3.6. You feed it your Python app, it does a lot of clever things, and spits out an execut |