I have some supportscript written in python that I thought would be nice to be able to run on client computers. So I was thinking about wrapping them in a GUI and compiling them to an .exe file, which of course seem troublesome.
I gave Pyinstaller a shot but with no luck so I moved forward to nuitka. This works with simple "hello world" scripts, but I need GUI and must be doing something wrong.
My environment is Windows7 x64 with 32-bit Python 2.7 (and 3.4) and Vs2010, 2013 installed.
I've tried different versions of the following command
nuitka --exe --recurse-all --standalone --windows-disable-console --python-version=2.7 helloTk.py
With TK it works on my developer machine, but if I move the Hello.dist folder to another machine nothing happens when I execute it, no errors, nothing.
With QT5 I get a warning from nutika which states something about it's unable to resolve QT imports.
So what am I missing or doing wrong here?
Regards
Related
"python --version
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."
This is what I get trying to make sure it works (clearly it doesn't). I'm quite a rookie with all this. I started cause I wanted to run some script on bluestacks, so I needed Python and ADB added both PATH. The problem comes here.... It is indeed added to Path:
C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Users\Sierra\AppData\Local\Microsoft\WindowsApps;C:\platform-tools;C:\Users\Sierra\AppData\Local\Programs\Python\Python39;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\Lib;
This is PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
This is PYTHONPATH (I made it since I saw someone saying it would fix it):
C:\Users\Sierra\AppData\Local\Programs\Python\Python39;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\Lib;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\include;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\DLLS;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\Sierra\AppData\Local\Programs\Python\Python39\Lib\site-packages
Weird enough the fact that ADB works fine:
C:\Users\Sierra>adb --version Android Debug Bridge version 1.0.41 Version 30.0.5-6877874 Installed as C:\platform-tools\adb.exe
Since I did the same in both cases, I can't get why it's not working. Maybe I did something wrong with the Python version I downloaded? Weird thing too, since I also have stilled version 3.8
Also, the script I need says "Python 3.7.X installed and added to PATH." I guessed 3.9 would work, since it's the newest
I apoloogize cause my English. I'm not native speaker, so I could have messed up somewhere. Many thanks!!
Forgot to tell, I use Windows 10
When you run the setup exe for python a list of tiny boxes should pop up and one will say add PATH to python? If you click yes it will add PATH to python which seems like your issue I think? If you have multiple versions of python installed that could cause a issue type python in cmd if it has a error then you didn't install python properly. Double check you have all the required modules installed if that doesn't work then I'm lost. Anyways here's the code to open cmd.
import os
os.system("cmd")
I wrote a program that takes a screenshot and sends it to my e-mail address. I made my python scripts executable using pyinstaller. I did it by executing command:
pyinstaller -w screenshot.py -F
The executable program ran perfectly on my PC but when I ran it to my
friend's PC, I got error saying "This app can't run on your PC. To
find a version for PC, check with the software publisher."
How can I solve this problem?
This error is not an error specific to Python. This is a warning the Windows 10 operating system gives the user when they attempt to run usually two kinds of programs:
A program deemed malicious by Windows
A program built on 64-bit system that is trying to run on a 32-bit system.
My guess is most likely option #2. There is nothing wrong with your code. But from what you described, this sounds like a problem with your usage of Pyinstaller. The way Pyinstaller builds programs is clever, but it depends on the system you built it on. For example, if you built the program on Windows 7, you will likely have problems running it on Windows 10.
See:
https://pyinstaller.readthedocs.io/en/stable/usage.html
So when distributing your program in this case, you are running into issues because you failed to target something about your friend's set up. Like if you used a 64-bit version of Python to freeze your script, and your friend is trying to run it on a 32-bit system. More details are needed to properly help you--like the version of Windows you built it on versus that of your friend.
I made an app with Pyqt, which I freezed with Pyinstaller with following options:- (Consider python file name as pyqt_link6.py)
pyi-makespec pyqt_link6.py
pyinstaller --noupx --debug pyqt_link6.spec
Resulting executable launches on my computer and several others (all Windows 7) and functions as expected. However on some machines (same Windows 7 version), it gives following problem:-
(pyqt_link6 is also name of directory where distribution is automatically stored by pyinstaller)
I thought adding --debug option during build was supposed to capture initialization process. But that is not happening.
My main problem is lack of indication of error. What should I look for to correct?
My Python version is 2.7.14 (Anaconda distribution), pyqt 5.6.0, pyinstaller 3.3.1.
I have intentionally not provided any more info, thinking that it may not be necessary and would be like spamming the forum. But should anything more (my python code or spec file be) posted here?. Any indication towards what the problem might be would be helpful.
As some machines can run exe and some can't; what difference should be looked at?
Regards,
I am trying to create an .exe file such that when run on any windows 10 pc will run without requiring any installations. What I tried using was:
pyinstaller --onefile main.py
I ran the exe file on a friend's computer and it turns out that it required first python2.7 to be installed, then it said that modules weren't installed i.e; no module named datetime found. The executable finally ran after I installed all dependencies on my friend's computer but the whole point of creating .exe file was useless, I might as well have just typed python main.py after doing so much. Is there an appropriate way I could get an .exe file from .py which wont require anything to be installed? Like an actual standalone app. Thank you!
Actually this should work. I never had problems with pyinstaller, yet. Maybe reinstall pyinstaller or make sure to use the newest version. Also try first of all an easy "helloWorld"
input("hello from Console.\nPress Enter to close it :)")
Just tried this one on a colleague's machine that has no python installed. And it worked well.
I've had good results using the pyinstaller module to one file even when running code with multiple dependencies on machines without python installed. Reading the documentation helped There is a comprehensive list of python to exe compilers in another stackoverflow question: a good python to exe compiler?
I have a rather strange problem.
When I run a python module (which imports other .py and .pyd files) from IDLE or in Debug mode from Eclipse, everything works fine and the final result is correct. But when I try to run the same module in run mode from Eclipse or from CMD, error window appears with 'python.exe has stopped working' message.
I managed to track the error down to the conclusion, that python stops working when a function from .pyd file is called (the import works fine). From there on I have no idea, what in causing the problems.
The .pyd input arguments are in all cases the same. Yet, python crashes, when the python module is run from cmd.
I am running a 64 bit Windows7, 64bit Python 2.6.6 and all python binaries .pyc are obtained on the same computer. No other python version is installed on the computer.
I would appreciate any advice, how to be able to run the code from cmd without python.exe crashing.
I had a similar problem...
this function:
pyd_function(num.asarray(arr).astype('float64'))
was causing problems when I ran it inside eclipse, but not when I debugged it inside eclipse or ran it from IDLE; then I changed the call to:
a=num.asarray(arr).astype('float64')
pyd_function(a)
and it started to work. I could not figure why the first call is causing problems.
I hope this helps you.