1

I am trying to use cx_Freeze to make an executable for my program. Even though the python program works perfectly, the executable says it cant file file_cleaner.

This is what the setup.py looks like

import sys
from cx_Freeze import setup, Executable
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')


build_exe_options = {"packages": ["os", "glob", "itertools", "numpy", 
    "matplotlib", "lmfit", "pandas", "scipy", "pathlib"], "includes": [
    "src\\BCS_fit.py", "src\\file_cleaner.py", "src\\__init__.py", 
    "src\\dependencies\\"], "include_files": ["test\\"]}

base = None


setup(name="BCS processor",
      version="0.1",
      description="Console application for processing VTS data and fitting it 
         according to BCS theory",
      author="Anil Radhakrishnan",
      options={"build_exe": build_exe_options},
      executables=[Executable("src\\Master.py", base=base)])

BCS_fit.py and file_cleaner.py are 2 other python files that I call from master.py. The Dependencies folder has .py and .pyd file from a c module converted to python.

This is the first time I am trying to create an executable for a python script, please excuse any beginner errors.

Thanks a lot for your assistance!

1 Answers1

0

In the past I've used py2exe, not sure if it works with Python 3.6 though,so depends what version you are currently using.

This SO has a quick guide to using cx_Freeze, maybe it covers something that you may have missed out?

Also Pynsist seems to be another very good way of creating an executable from a Python script. It can also create installation files for your program.

Spriggsy
  • 196
  • 1
  • 18