2

i coded a python script in pycharm as "probe.py" and later built the executable(.exe) file out of it using the mentioned code in setup.py file but the exe file thus created shows error on opening as import error mising required dependency['numpy'] even when it is present in my project.

error image

enter image description here

  import sys

  from cx_Freeze import setup,Executable


  include_files = ['autorun.inf']
  base = None

  if sys.platform == "win32":
  base = "Win32GUI"

  setup(name="Probe",version="0.1",description="fun",
  options={'build_exe':{'include_files': include_files}},
  executables=[Executable("probe.py",base=base)])

`

Nihal
  • 5,262
  • 7
  • 23
  • 41

2 Answers2

1
from cx_Freeze import setup, Executable
   base = None
   if sys.platform == "win32":
     base = "Win32GUI"
   build_exe_options = {"packages": ["numpy"],
     include_files = ['autorun.inf']}

   setup(
        name = "Probe",
        version = "0.1",
        description = "fun",
        options = {"build_exe": build_exe_options},
        executables = [Executable("probe.py",base=base)]
        )

run this script tell me if there is a problem

Nihal
  • 5,262
  • 7
  • 23
  • 41
0

According to cx_Freeze documentation, try adding build_exe with a packages key.

jambox
  • 584
  • 4
  • 15