0

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!

malloc
  • 21
  • 4
  • The whole point of pyinstaller is to avoid installing dependencies. I can't say what you're doing wrong for sure without more information so let me start with this: What happens when your friend opens the main.exe file on his computer? – Algorithmic Jul 07 '17 at 15:24

2 Answers2

0

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.

stranger0612
  • 301
  • 1
  • 2
  • 12
  • Yes. I've already created .exe with matplotlib, numpy, pythonnet and pywinauto as well. Some were with Python's version 3.6 and some with version 2.7 – stranger0612 Jul 07 '17 at 10:59
0

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?

BoboDarph
  • 2,751
  • 1
  • 10
  • 15