Search code examples
pythonperformancecx-freeze

Import error cx_freeze.util


Im trying to make my Tkinter Calculator into a .exe file using cxfreeze. My python version is 3.5.2 and i have the appropriate cxfreeze version.

I run the command python.exe setup.py build in CMD.

     c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32>python.exe        

     setup.py
     build
     running build
     running build_exe
     Traceback (most recent call last):
     File "setup.py", line 13, in <module>
     executables = [Executable("PTF.py")]  ,
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-    32\lib\site-pac
     kages\cx_Freeze\dist.py", line 349, in setup
     distutils.core.setup(**attrs)
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-  32\lib\distutil
     s\core.py", line 148, in setup
     dist.run_commands()
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\distutil
     s\dist.py", line 955, in run_commands
     self.run_command(cmd)
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\distutil
     s\dist.py", line 974, in run_command
     cmd_obj.run()
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\distutil
     s\command\build.py", line 135, in run
     self.run_command(cmd_name)
     File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35- 32\lib\distutil
     s\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\distutil
    s\dist.py", line 974, in run_command
    cmd_obj.run()
    File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\site-pac
    kages\cx_Freeze\dist.py", line 218, in run
    zipExcludePackages = self.zip_exclude_packages)
    File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\site-pac
    kages\cx_Freeze\freezer.py", line 142, in __init__
    for n in self._GetDefaultBinPathExcludes() + binPathExcludes]
    File "c:\Users\Elar2408\AppData\Local\Programs\Python\Python35-32\lib\site-pac
    kages\cx_Freeze\freezer.py", line 256, in _GetDefaultBinPathExcludes
    import cx_Freeze.util
    ImportError: No module named 'cx_Freeze.util'

That is the following error i get at the bottom. I have tried to fix it alot of diffrent ways but i just cant seem to be able to fix this module issue. Any help is greatly appreciated


Solution

  • That error implies that your installation of cx_Freeze is broken. You can install a pre-built version from PyPI by issuing the following command:

    python -m pip install cx_Freeze --upgrade