Search code examples
pythonexecutablecx-freezefile-conversion

When converting a python file to an executable I get a "no module named cx_freeze.util" error


I am trying to convert a simple .py file into an .exe file in order to easily distribute it. I have looked up a few tutorials and realized that cx_Freeze seems to be the best route, however I have not found a solution for this error yet. If anybody can help please let me know.

The setup.py file I am using:

import sys
from cx_Freeze import setup, Executable

setup( name = "project",
    version = "0.1",
    description = "Makes life easier",
    executables = [Executable("project.py")])

This file is in the same folder as the project.py file, and the 3.6 version of cx_Freeze is installed locally. However this error appears:

enter image description here

Thus far I have tried re-installing cx_Freeze, simply not using the python path, and that's about it as i'm not sure where to go next. If anyone has any ideas it would be greatly appreciated. If you need more info please tell me. I am on Python 3.6 if that helps.


Solution

  • That error suggests that your installation is flawed. Please use this command instead and retry afterwards.

    python -m pip install cx_Freeze --upgrade