Reputation: 2405
I'm trying to create an executable file that I can run on Windows from a python file. I'm using a Mac and and trying to do this using cx_Freeze. I have a folder with 2 files in it: pyTest.py and setup.py. Here is the contents of pyTest.py:
import numpy as np
print(np.sqrt(2))
here is the contents of setup.py:
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ['numpy'],
"excludes": ['Tkinter', 'tcl', 'ttk']}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name='test1',
version='0.1',
description='test',
options = { "build_exe" : build_exe_options},
executables = [Executable('pyTest.py', base=base)])
when I run the terminal python setup.py build
, a folder called "build" is created which contains only another folder called "exe.macosx-10.6-intel-2.7" which contains a folder called "lib", libncursesw.5, pyTest, Python. pyTest and Python are both Unix executables. I am using a second computer which has Windows 10 which I am trying to use to run the .exe file I'm trying to make. I tried running the pyTest file but it does not work.
Upvotes: 1
Views: 2478
Reputation: 51
From the post in the "Linked" category :
" Freezing for other platforms
cx_Freeze works on Windows, Mac and Linux, but on each platform it only makes an executable that runs on that platform. So if you want to freeze your program for Windows, freeze it on Windows; if you want to run it on Macs, freeze it on a Mac.
At a pinch, you can try to make a Windows executable using Wine. Our experience is that you need to copy some files in manually after cx_Freeze has run to make the executable work. We don’t recommend this option. "
Have been trying all morning too, this is kinda disappointing. Maybe I'll use py2exe
Upvotes: 2