I'm using pyinstaller to make an macos app out of a .py file using tkinter to build a GUI, and every time I build it and go into the dist/programname directory and try running the programname executable, it spits the following out at me before deleting/removing the executable:
myname#C02F508MML7L ~ % /Users/username/Documents/dist/programname/programname ; exit;
zsh: killed /Users/username/Documents/dist/programname/programname
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
I'm not positive what's causing this? I've used almost the same code without tkinter to create an executable and it worked just fine
Related
I want to compile a python script (GUI application written by pyqt5) into a single exe file. I have successfully done it on window with pyinstaller. However, when I tried the same thing on Linux(CentOS7), it turned out to be a "shared library" items. I could still run the file from terminal but I want to get an applicaiton that can be opened by simply double-click.
I have created a PyInstaller file that runs perfectly on my computer. This file contains version 3.7.7 of python, selenium module, requests module, random module, and time module. However, when I attempt to send it to another computer that has the same OS. it produces this error:
[1174] Error loading Python lib '/var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python': dlopen: dlopen(/var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python, 10): Symbol not found: _futimens
Referenced from: /var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python
Expected in: /usr/lib/libSystem.B.dylib
in /var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
It appears that the error is happening because it cannot find a python file. My goal is to run this on a computer with the same OS without python installed. Is there a way to do this?
Yes there is a software that converts the whole project into an .exe file that can run on any Windows machine.
Download NSIS
There's tonnes of tutorials on how you can proceed from here, I can't explain the whole thing.
Hope this is what you're looking for.
Created Setup file and used the following command to generate exe file.
python setup.py bdist
If you're on windows you can use a cmd window to call it, and the output or error should show in the window
cd C:\yourlocation
yourexe.exe
I am making a really simple app in python, using Tkinter as GUI, and cx_freeze to build it.
It all is in a simple "sleep.py" file.
The setup.py file used by cx_freeze is as follows :
from cx_Freeze import setup, Executable
executables = [
Executable('sleep.py', base=None)
]
setup(name='Sleep Calculator',
version='0.90',
description='Sample cx_Freeze script',
executables=executables
)
The sleep.py file is launching correctly :
- When launched in MacOS from the terminal
- When built in MacOS using python3 setup.py build
- When built in Windows using python3 setup.py build_exe and then copying the tkinter files manually into the build folder created by cx_freeze
So I have a sleep.py file that is working both from Windows and Mac, a script that is working in MacOS, and an EXE that is working on Windows.
However, when trying to build to a .app using python3 setup.py bdist_mac, I get an app that is instantly closing on launch.
The only message I get during the launch, in the console, is
"Loading Preferences From User CFPrefsD For Search List"
During build, I get multiple
fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failederrors. Xcode is not installed, but CommandLineTools is.
I know almost nothing of OS X at the moment, so any help is welcome,
Thanks !
I had the same problem where an app with cx_freeze would close as soon as I opened it, but running the executable inside the package would work.
It was solved for me by opening the built package and editing the info.plist file.
After adding a bundle identifier it started as it should.
<key>CFBundleIdentifier</key>
<string>My App</string>
I have a Python script that I have turned into an executable using cx-freeze-4.3.4.win32-py3.4. I have Python 3.4 installed on a Windows 7 64-bit machine.
Here is my simple setup.py file:
from cx_Freeze import setup, Executable
setup( name = "myfilename" ,
version = "0.1" ,
description = "This is my file" ,
executables = [Executable("myfilename.py")] , )
I ran python setup.py build from command prompt in the C:\Python34 folder with both the script I was trying to convert and the setup.py file.
This created another folder called build within was another folder called exe.win32-3.4. In that folder I found my executable file, a bunch of .pyd files, a single .dll file, and a zipped archive called library of a bunch of .pyc files.
If I run the executable from within the exe.win32-3.4 with the library zip archive it executes fine. However, without the library archive of .pyc files (basically if I try just to run the .exe by itself, which is what I am supposed to be able to do) the executable throws out this error:
Fatal Python error: cannot get zipimpirter instance
Current thread 0x000001b48 (most recet call first):
I did some preliminary searching around the web for potential resolutions to the issue but could not find anything substantial. If anyone knows how to troubleshoot this issue that would be much appreciated.
From the docs:
Single-file executables
cx_Freeze does not support building a single file exe, where all of the libraries for your application are embedded in one executable file.
For a single-file solution using py2exe and others, see this question.
In 3.5 there is also the new zipapp module, although the basic functionality has been around for a while.