I have a simple application made in python3, I only have one window and a button, try it with the bdist command:
python setup.py bdist --format=zip
but not working for me.
with: cx_Freeze
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "guifoo",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("text.py", base=base)])
Have any suggestions or recommendations?
a folder is created but I dont see the .exe
If I use images where should I put it?
What about the modules?
What happens if I use relative paths?
Have you tired PyInstaller?
PyInstaller supports cross-compilation:
Add support for cross-compilation: PyInstaller is now able to build Windows executables when running under Linux. See documentation for more details.
More information here
Hope this helps :)
Related
So I managed to compile my program into a .exe file with 'cx-freeze' and everything runs perfectly fine besides the functions that use Pytesseract.
I know that the error is because you're required to set your Pytesseract path as I do here:
pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract'
I know a simple fix is to have the user download and install pytesseract OCR but thats not an efficient solution, surely there's a way to fix it.
Setup.py I used to compile into a .exe using cx-freeze:
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["tkinter","sys","pynput","time","pyautogui","PIL","os","win32api","win32con","cv2","pyperclip","pytesseract","numpy","threading","mysql.connector"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = "Win32GUI" # <- no command line will appear
target = Executable(
script="MatrixARKBot.py",
base=base,
targetName="MatrixARKBot.exe")
setup( name = "MatrixARKBot.py",
version = "0.1",
description = "Matrix ARK Bot",
options = {"build_exe": build_exe_options},
executables = [target])
```
I have a python program that uses the Graphiz module, the output of the program uses the Graphviz windows installation to create an image.
My program is for average windows users and my goal is to deliver one msi installer.
I don't have issues using the cx_Freeze to pack my python modules and run the outcome afterwards...
The problem is, the program depends on the installed Graphviz dir to create the image from my programs output moreover the dir's bin folder should be in the system path....
If there is a solution using cx_Freeze (and I tried and didn't find one)
pls help me
If not pls advice how can I circumvent this problem
Thanks a million!
import sys, os
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["PIL.Image",
"tkinter",
"graphviz",
"Rec_FFT",
"graph_visualization",
"math",
"cmath"],
"include_files": [
r"D:\Yigal\Python36-32\DLLs\tcl86t.dll",
r"D:\Yigal\Python36-32\DLLs\tk86t.dll"],
}
base = None
if sys.platform == "win32":
base = "Win32GUI"
# pass # base=None is for console apps
os.environ['TCL_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tk8.6'
setup(name="FFTCalc",
version="0.1",
description="# Rec FFT Calc #",
options={
"build_exe": build_exe_options
},
executables=[Executable("Rec_FFT_GUI.py", base=base)])
This is the output when Graphiz is not installed:
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tjpeg', '-O', 'FFT_RESULTS\\graph'], make sure the Graphviz executables are on your systems' PATH
I can see it is missing the dot.exe ... but how can I pack it with cx_Freeze??
I have problems with compilation python 3.6 to exe using cx_Freeze-5.0.1-cp36-cp36m-win32.whl, help me please.
I have installed Cx-freeze from http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
Then i started cmd and run this command:
python setup.py build
setup.py file is below:
import sys
from cx_Freeze import setup, Executable
setup(
name = "Check Telemetry",
version = "0.1",
description = "Check Telemetry",
executables = [Executable("excel_to_sqlite_xlrd-light.py", base = "console")])
Then i have something like this:
But if i run my .exe file i have problem below:
Screenshots with lines that have mistakes below:
Have you got any ideas?
Thank you!
seems that the program doesn't find the dependencies so add this (you have to add the missing dependencies (in this example i put os):
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
and then:
setup( name = "Check Telemetry",
version = "0.1",
description = "Check Telemetry",
options = {"build_exe": build_exe_options},
executables = [Executable("excel_to_sqlite_xlrd-light.py", base = "console")])
I have a python script that I'd like to freeze. I made the cx_freeze script, and ran it. The .exe works well, but in the frozen script I open a .html file. When the file opens the webbrowser gives me the error "File not found: Firefox cannot find the file at /c:/blah/blah/blah/somefile.html"
As I understand it, this is because cx_freeze is confusing my OS between linux and Windows. However, I'm not sure this is it because I have the code
if sys.platform == "win32":
base = "Win32GUI"
In my setup file. Does anyone know what's going on?
My entire setup file is
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "someexe",
version = "0.1",
description = "someexe description",
options = {"build_exe": build_exe_options},
executables = [Executable("someexe.py", base=base)])
copied from the cx_freeze distutils page and edited to fit my needs.
Instead of using os.chdir('C:/path/to/dir'), you should be using os.chdir('C:\path\to\dir'). It's an error in your script, not your cx_freeze setup file.
Ok so I have python 3.2 installed and I have cx_Freexe 4.2.3 installed.
I have a folder called Python stuff. In this folder there are 2 files.
setup.py and holg.py (my application)
Here is my setup.py:
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "holgame",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("holg.py", base=base)])
The next step I have been doing is Run > cmd:
python setup.py build
what I get is:
'python' is not recognized as an internal or external command, operable program or batch file.
I am only a beginner so I need clear steps. Maybe my programs should be in a different folder or something, I can't really be sure. Does anyone know what the problem is? Thanks
You either need to put Python on the Windows path, or you need to use an explicit path to python. Try:
$ \Python32\Python setup.py build
Here are some good instructions for getting Python installed on your Windows machine: https://openhatch.org/wiki/Boston_Python_Workshop_5/Friday/Windows_set_up_Python
You will first need to cd to the directory containing your code and setup.py. You should find a Windows command prompt tutorial to help with some of this basic stuff.