0

I am having trouble running an .exe file that i've created from python which uses numpy. After running the .exe from the cmd a log file is created with the text: ImportError: No module named numpy (even if it is installed on the computer). I assume the solution is to import numpy to the setup file but don't know how and if additional files are need to be copied to the file directory. How can I run the exe in a computer without numpy?

I used py2exe and this setup file:

    from distutils.core import setup
    import py2exe, sys, os

    sys.argv.append('py2exe')

    setup(
    options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
    windows = [{'script': "solver.py"}],
    zipfile = None,

) Thanks!

Alona
  • 1
  • 2
  • By the way how you converted python file to exe? Which module you used (py2exe / cxfreeze or something else). Please make the question more specific, if possible post the code too. – Sundararajan May 04 '17 at 05:36
  • I would recommend using cx_freeze to package your file to an exe. you dont have to worry about dependencies when using cx_freeze as you can specify the same in you setup.py file. – DineshKumar May 04 '17 at 06:29

1 Answers1

0

I've also experienced this issue with py2exe (Seems to be a known issue, check comment on this) and since I couldn't make or find a way to workaround it I decided to use PyInstaller instead. After installing you'll just need to go to your program's directory and run

pyinstaller solver.py --onefile 

to create a bundled executable with no dependencies in a subdirectory called dist. PyInstaller is compatible with Python 2.7 and 3.3-3.5.

Community
  • 1
  • 1
Vinícius Figueiredo
  • 6,300
  • 3
  • 25
  • 44