How to create .exe using py2exe(or pyinstaller) on Ubuntu

Yuriy Leonov

Given:
- Ubuntu
- py2exe and pyinstaller - Python script with setup.py (or else)

from distutils.core import setup
import py2exe
import os

setup(
version = "1.0",
description = 'foo',
url = "",
name = "foo",
console=[{
    "script":"main.py",
    "dest_base":"foo",
}],
zipfile = "shared.dll",
options = {"py2exe":{
    'bundle_files': 1,
    'optimize': 2,
    "dll_excludes": ['MSVCP90.dll', 'msvcr71.dll', "IPHLPAPI.DLL", "NSI.dll",  "WINNSI.DLL",  "WTSAPI32.dll"],
    "includes": ["utils"]
}}
)

Need:
- One .exe file and maybe some .dll (I realy don't know)

Steps what I did:
- setup pip3 and python 3.4 (https://askubuntu.com/questions/524399/issues-with-py2exe)
- setup py2exe for ubuntu "pip3 install py2exe"
- run "python3.4 setup.py py2exe" And got following traceback:

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    import py2exe
  File "/usr/local/lib/python3.4/dist-packages/py2exe/__init__.py", line 9, in <module>
    patch_distutils()
  File "/usr/local/lib/python3.4/dist-packages/py2exe/patch_distutils.py", line 68, in patch_distutils
    from . import distutils_buildexe
  File "/usr/local/lib/python3.4/dist-packages/py2exe/distutils_buildexe.py", line 91, in <module>
    from . import runtime
  File "/usr/local/lib/python3.4/dist-packages/py2exe/runtime.py", line 3, in <module>
    from .dllfinder import Scanner, pydll
  File "/usr/local/lib/python3.4/dist-packages/py2exe/dllfinder.py", line 5, in <module>
    from . import _wapi
  File "/usr/local/lib/python3.4/dist-packages/py2exe/_wapi.py", line 4, in <module>
    _kernel32 = WinDLL("kernel32")
NameError: name 'WinDLL' is not defined


- setup pyinstaller for ubuntu (https://github.com/pyinstaller/pyinstaller/wiki)
- run "pyinstaller setup.py"(same as "pyinstaller -w setup.py") and got in dist folder many files with extension .so and one file "setup" without extension

What am I doing wrong?
How can I get .exe file under Ubuntu?
Is it possible?

PS: I've read Python executables: py2exe or PyInstaller? by I didn't find answer.

Mike Driscoll

You cannot use py2exe on Ubuntu or Linux in general. You cannot use it on Mac either. It is a Windows-only utility! You have to use it within Windows, whether that be in a Windows virtual machine or an actual Windows machine.

As for PyInstaller, please read the docs:

Can I use PyInstaller as a cross-compiler?

  • Can I package Windows binaries while running under Linux?

    No, this is not supported. Please use Wine for this, PyInstaller runs fine in Wine. You may also want to have a look at this thread in the mailinglist. In version 1.4 we had build in some support for this, but it showed to work only half. It would require some Windows system on another partition and would only work for pure Python programs. As soon as you want a decent GUI (gtk, qt, wx), you would need to install Windows libraries anyhow. So it's much easier to just use Wine. - source

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I include poppler to pyinstaller generated exe when using pdf2image?

From Dev

How do I include poppler to pyinstaller generated exe when using pdf2image?

From Java

Encapsulate .py and .txt file into .exe file using PyInstaller

From Dev

How to get a working EXE file using pyinstaller with the sounddevice module in Python

From Dev

How do I create a Windows executable with PyInstaller on Ubuntu?

From Dev

Pyinstaller on Kali to create exe for Windows XP

From Dev

How to create an executable file for Linux machine using Pyinstaller?

From Dev

How to create a standalone exe using python 3.4

From Dev

Create a single-file executable using py2exe

From Dev

Pyinstaller and --onefile: How to include an image in the exe file

From Dev

Pyinstaller and --onefile: How to include an image in the exe file

From Dev

PyInstaller / py2exe distribution is too large

From Dev

I'm not able to convert my python file into a exe using pyinstaller

From Dev

How to create obj file using cl.exe

From Dev

How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?

From Dev

How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?

From Dev

Pyinstaller, .py version works, .exe "No module named Tkinter"?

From Dev

PyInstaller .exe file not working

From Dev

pyinstaller exe blank screen

From Dev

Pyinstaller compile to exe

From Dev

Exe to python with pyinstaller?

From Dev

Reducing size of pyinstaller exe

From Dev

pyinstaller exe with pubsub

From Dev

PyInstaller .exe file not working

From Dev

py2exe/pyinstaller: Is it bad practice to put all configurable variables in a .py file?

From Dev

py2exe/pyinstaller: Is it bad practice to put all configurable variables in a .py file?

From Dev

Create .exe file under Ubuntu in with JavaFX

From Dev

How to install .exe on ubuntu 12.04

From Dev

how to execute .exe on ubuntu linux/

Related Related

  1. 1

    How do I include poppler to pyinstaller generated exe when using pdf2image?

  2. 2

    How do I include poppler to pyinstaller generated exe when using pdf2image?

  3. 3

    Encapsulate .py and .txt file into .exe file using PyInstaller

  4. 4

    How to get a working EXE file using pyinstaller with the sounddevice module in Python

  5. 5

    How do I create a Windows executable with PyInstaller on Ubuntu?

  6. 6

    Pyinstaller on Kali to create exe for Windows XP

  7. 7

    How to create an executable file for Linux machine using Pyinstaller?

  8. 8

    How to create a standalone exe using python 3.4

  9. 9

    Create a single-file executable using py2exe

  10. 10

    Pyinstaller and --onefile: How to include an image in the exe file

  11. 11

    Pyinstaller and --onefile: How to include an image in the exe file

  12. 12

    PyInstaller / py2exe distribution is too large

  13. 13

    I'm not able to convert my python file into a exe using pyinstaller

  14. 14

    How to create obj file using cl.exe

  15. 15

    How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?

  16. 16

    How to create menu item in OSX Menubar using Pyinstaller packaged Kivy Python application?

  17. 17

    Pyinstaller, .py version works, .exe "No module named Tkinter"?

  18. 18

    PyInstaller .exe file not working

  19. 19

    pyinstaller exe blank screen

  20. 20

    Pyinstaller compile to exe

  21. 21

    Exe to python with pyinstaller?

  22. 22

    Reducing size of pyinstaller exe

  23. 23

    pyinstaller exe with pubsub

  24. 24

    PyInstaller .exe file not working

  25. 25

    py2exe/pyinstaller: Is it bad practice to put all configurable variables in a .py file?

  26. 26

    py2exe/pyinstaller: Is it bad practice to put all configurable variables in a .py file?

  27. 27

    Create .exe file under Ubuntu in with JavaFX

  28. 28

    How to install .exe on ubuntu 12.04

  29. 29

    how to execute .exe on ubuntu linux/

HotTag

Archive