0

I am using the cx_Freeze script located in the Python36/Scripts folder on a regular basis to convert python files into executables and it works fine. However it seems to still not being able to convert numpy so I am trying to make it work by adding an option into the main.py which is used by the cx_Freeze script described above. This main.py is located in the site-packages/cx_Freeze folder.

Thomas K. provided a solution here: Creating cx_Freeze exe with Numpy for Python

by adding this line to the options:

options = {"build_exe": {"packages": ["numpy.lib.format"]}}

Is it possible to add this line to the main.py in the options section? If so how would I do that?

Your help is much appreciated.

jpeg
  • 2,372
  • 4
  • 18
  • 31
Artur Müller Romanov
  • 4,417
  • 10
  • 73
  • 132

1 Answers1

0

If I understand correctly what you like to do, you could try to add the following two lines to the file site-packages/cx_Freeze/freezer.py

@@ -127,6 +127,8 @@ class Freezer(object):
         self.includes = list(includes)
         self.excludes = list(excludes)
         self.packages = list(packages)
+        if 'numpy.lib.format' not in self.packages:
+            self.packages.append('numpy.lib.format')
         self.namespacePackages = list(namespacePackages)
         self.replacePaths = list(replacePaths)
         self.compress = compress
jpeg
  • 2,372
  • 4
  • 18
  • 31