Good day, everyone!
I made a python script in my Windows 10 laptop that exports sql data into text file. The script was compiled into an executable file via the pyinstaller python package. The exe runs perfectly on my laptop with no issues. However, when I copy/pasted the directory of the exe files in to another laptop (with Windows 7 OS) and run it, errors occur. So, I tried to install python and all the packages I've installed in my laptop to run the script. Yet, the errors remain. Please check the ss of the errors below.
When I run the exe file this pops up
If I click OK, two pop ups appear with the same content
To tell you the truth, this is my first time writing a python script so I may be missing some important details. Please, do explain to me how I can fix these errors. Thank you in advance!
[UPDATE]
I tried to copy/paste the raw python script (pyw) and compiled it to exe on the Windows 7 laptop itself. The error being shown this time when I run the new exe file is "Failed to execute script transfer_out_exporting". No other details are given.
Problem Solved
First, I copied the raw python file (pyw) and compiled it on the Windows 7 laptop itself. This solved the api-ms-win-core dll and python dll issues. Then, I added the read and write files that the exe uses for some data referencing.
The exe was running after doing those steps. I think I was overthinking the problem when I simply had to look at my script. Make sure to always check your script!
Python 3.9 does not seem to be supported on Windows 7 anymore. At least Python 3.7 works on Windows 7 (I don't know about Python 3.8). So, you could compile the program on e.g. Windows 10 within an (anaconda) environment using Python 3.7 and pyinstaller and the resulting compiled program should work on Windows 7.
Related
I am a beginner in python and seeking some help on this matter. I want to convert my python script into .exe file which can further be used by the user that don't have python installed. I used to be able to create .exe files using pyinstaller and they worked perfectly. I had used the libraries like pandas, numpy, datetime, pyodbc.
Now, I created a new script that ran perfectly using jupyter notebook and I converted it into exe file, but when I run the file, it opens the command prompt and stays open forever but does nothing. I had two new libraries that I used this time 'xlwings', 'shutil'. I thought that might be the problem so I ran the same script removing those two libraries but still can't get it working. I am completely stuck here and couldn't figure what went wrong.
I've added a print('Start') command in the beginning of the script but the exe file doesn't even read that. Seems like it isn't executing the code at all.
I am using python 3.9.5 and PyInstaller version 4.10 and running it on windows 10.
Thanks in advance.
I am running a Cryptocurrency-trading python program on my laptop
It monitors the market every second and when the condition is satisfied, it tries transactions.
When I run it on windows CMD, it causes many problems below.
1. Sometimes, it halts till I click the cmd window and press 'enter' key
2. Sometimes, it causes many unknown errors.
However, when I run that on VScode, it does not cause any problem.
I wonder what makes the difference between those two environments.
I have had some issues with VSCode not finding libraries and similar, and the reason for that is that VSCode runs its own python. In IDLE (and CMD) you run the raw python in AppData, but VSCode runs an executable they have downloaded via extensions through the program files folder.
My hypothesis is that Python as in the AppData folder is corrupted or wrong in some way, but the Program Files folder is correct. It may even be on a different python version.
Try reinstalling python from the official python website, and run it again. Also double-check that the VSCode Python extension version is the same as the one saved in "C:\Users\YOURUSERNAME\AppData\Local\Programs\Python\Python39".
Hope it worked!
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 am trying to run a Python project that uses the wxPython module but the problem is that I don't have any idea why isn't working.
I tried to run it on Windows 10 (School) and it runs fine but when I try to run it at home with my Windows XP it doesn't run. The main problem is that it doesn't say any problem, it just seems to run but it doesn't.
I am using Python 2.7 and I am not running the .exe file from the application I just run the .py file that executes everything. (I did in the same way in both Operating systems)
I have installed wxPython 4.0.2.
Is that I am missing something??
I am new in this, so pls don't be so hard!
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?