1

So... simple question: I'm trying to use cx_Freeze to build an .exe file.

In my script I import some packages, functions from another .py file and also an array from a .csv file.

How do I compile this into one .exe file / a directory containing an .exe file?

I've noticed that there is a "options" parameter, which I tried filling with

"packages": ["numpy","pandas","userinput","Atoms.csv"]

But no luck. The .exe file just opens and closes again

EDIT So I've changed the setup.py to

from cx_Freeze import setup,Executable

includefiles = ['Atoms.csv','userinput.py']
includes = []
excludes = []
packages = ['numpy','pandas']

setup(
    name = 'Molar mass',
    version = '1.0',
    description = 'A calculator for the molar mass',
    author = '',
    options = {'build_exe': {'includes':includes,'excludes':excludes,'packages':packages,'include_files':includefiles}}, 
    executables = [Executable('Molarmass.py')]
)

Which gives me the error "ImportError: No module named 'numpy'" And if I try to run it without the packages, I can't open the .exe file.

0 Answers0