creative head
creative head

Reputation: 23

error in creating executable file from python

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)])

`

Upvotes: 2

Views: 123

Answers (2)

Nihal
Nihal

Reputation: 5324

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

Upvotes: 1

jambox
jambox

Reputation: 580

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

Upvotes: 0

Related Questions