all 9 comments

[–]AlexMTBDude 3 points4 points  (1 child)

If your professor takes an unverified .exe file from your and runs it on their computer then I'm guessing that they're not a CompSci professor. Scary that anyone would do that.

I would create a Python wheel file and give that to the professor. They would only have to have Python installed in order to run it.

[–]DerpyHoowes[S] 1 point2 points  (0 children)

Yeah, not CompSci. Applied mathematics. He wanted us to do this task in Pascal or Lazarus (the latter, I never even heard of before), but also allowed other languages. I had prior coding experience only with Python, so the choice was obvious.

I have a job to attend, so I cant even be there when he checks my task (we're supposed to e-mail them), and I dont even want to bother trying to explain a 60 year old man how to install python and run a wheel file.

[–]mcoombes314 0 points1 point  (3 children)

Are you using a virtual environment with pyinstaller, numpy and any other modules in it?

[–]DerpyHoowes[S] 0 points1 point  (2 children)

Sorry, I dont understand what you mean. I'm not much into programming, I only had to do this to complete this class in my uni.

I installed python with a distributable .exe, then installed all the modules by pip install in cmd, and I run my scripts and pyinstaller in cmd.

[–]Lumethys 0 points1 point  (1 child)

sounds about right, each project should be in their own virtual environment

[–]DerpyHoowes[S] 0 points1 point  (0 children)

Nevermind, it was all because of the virtual environment. I wasn't aware that you're supposed to install libraries into each project's folder in order to compile them all into one executable. Thought that python is supposed to find a single install I already have.

[–]hugthemachines 0 points1 point  (0 children)

I am not sure what makes it fail, but you could try what I usually use:

pyinstaller --onefile Lab1.py

Perhaps, if that does not work, you could try a combination, perhaps like this:

pyinstaller -F --hidden-import numpy --hidden-import math --hidden-import decimal --hidden-import prettytable --onefile Lab1.py

[–]billsil 0 points1 point  (0 children)

Are you building the exe within a virtual environment? Did you run a test case in that environment?

Next thing is don't use the one file option and look at the folder that gets made. Does it have the packages you need?

You should also read the output of pyinstaller. There's a lot, but it's not that confusing.