Let’s say I had three scripts. Main.py (has all imports), 1.py (random script), 2.py (random script).
pyinstaller -F --onedir Main.py (80mb)
pyinstaller -F --onedir 1.py (80mb)
pyinstaller -F --onedir 2.py (80mb)
This creates 3 folders I then copy 1.exe and 2.exe to Main folder with all dependencies and this runs fine.
Two issues are present:
The issue is the size. One file reduces this to 30mb, one folder keeps it at 80mb
More importantly, the exe’s are unable to leave that folder. I’ve had to resort to using shortcuts in Python.
I am following this, which supposedly is a workaround.
My question is, how can I read the imports from a select location with pyinstaller so I can move the executables?
Logic:
Compile Main.py using pyinstaller -F –onefile Main.py (15mb).
Create folder at C:\13\
so exe looks like C:\13\Main.exe
link all exe's at C:\13
? with --runtime-tmpdir PATH
I am struggling to find documentation on getting imports from inside the exe or even "one dir"
folder. There is plenty on getting imports from the get go, but not much on getting imports from a select location so I can run the exe anywhere. What's more, it is hard to even find the modules in pyinstaller short of decompiling it adding to this confusion.
Perhaps...
pyinstaller -F --runtime-tmpdir C:\13 --onefile 2.py
pyinstaller -F --runtime-tmpdir C:\13 --onedir 3.py
Though for me no directory is created. How do I go about getting imports from a select location.
Another possible solution:
if getattr(sys, 'frozen', False):
os.path.join(sys._MEIPASS, "C:\aa")
Though as you can see in the image, it’s lets say we wanted pandas there are a few files to choose from...