0

I have a working game developed on codeskulptor simplegui tools. I converted it to pygame though SimpleGUICS2Pygame. I tried to convert it to exe, it ran this error: [Errno 2] No such file or directory: 'numpy-atlas.dll'

I looked into this thread:Py2Exe, [Errno 2] No such file or directory: 'numpy-atlas.dll'

I tried copying the numpy-atlas.dll to the code file directory, It worked, but when I tried to run the exe file, the command line just pops out and disappear.

I found the last answer to work, though I don't know how/where to run such a code:

    from distutils.core import setup
    import py2exe

    import numpy
    import os
    import sys

    # add any numpy directory containing a dll file to sys.path

    def numpy_dll_paths_fix():
        paths = set()
        np_path = numpy.__path__[0]
        for dirpath, _, filenames in os.walk(np_path):
            for item in filenames:
                if item.endswith('.dll'):
                    paths.add(dirpath)

        sys.path.append(*list(paths))

    numpy_dll_paths_fix()
    setup(...)

I recompiled it using pyinstaller, it succeeded, but no functionality, here is what the spec file looks like:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['balling.py'],
             pathex=['C:\\Users\\SamsunG\\Desktop\\Python 2017\\convert'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='balling',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='balling')
v_head
  • 759
  • 4
  • 13
  • 1
    Maybe use cx_Freeze or even better - Pyinstaller? – Kotauskas Sep 21 '17 at 11:23
  • I have used pyinstaller, everything ran okey, but when I tried to get my exe game working in the distribution directory, windows asks for shutting up the command prompt. My game has no outside paths, it's pong. Please look up above for the spec file for the created bundle. – v_head Sep 22 '17 at 21:47

1 Answers1

0

I never used and will never use neither py2exe nor py2app. I always used cx_Freeze and then deleted it and installed Pyinstaller because it offers run bat or shell -> delete build dir -> go to dist dir -> run that exe system. To use it:

  1. Install Pyinstaller: type pip install pyinstaller in your shell. On Windows, do not forget to run it with Admin rights if Python is installed for all users.

  2. cd into dir with your Python file.

  3. Make sure you have cutpasted "build" folder (if present). Type pyinstaller <python_file_name> --noconsole -F. --noconsole is for removing console window in the exe, -F is for singlefile compiling. This is why I prefer Pyinstaller.

  4. Wait some time. Then get your .exe!

  5. Delete the appeared "build" folder.

Pyinstaller is cross-platform (but Pyinstaller for Windows will only compile for Windows, Pyinstaller for Linux will only compile for Linux, Pyinstaller for MacOS will only compile for MacOS etc).


Set console to False or use --noconsole when compiling when EXEing games or GUI apps.

Kotauskas
  • 1,239
  • 11
  • 31