Search code examples
pythonpyinstallerpython-import

Packages is not working with pyinstaller. How to fix it?


I have issues with imports and packages with pyinstaller. So it's exception, that pyinstaller can't find package. I tried relative paths, gives exception about relative paths without parent package. everything works fine and all tests are passing if I run script via terminal. Also I noticed that while compiling instead of path to my folder after modifying PYTHONPATH it prints D:\. I think changing this to my folder may fix this, but I didn't find way to do this. I even tried add path manually using system env variables, this didn't worked. Also my project contains __init__.py for every package, including main package. You can check structure of files here : https://github.com/farkon00/binarian.

Sorry for not including source code here, but it is too complecated, so I can`t post it here.


Solution

  • Ok, I fixed it. So I used --paths and set it to my directory. Command looks like this :

    pyinstaller binarian.py --paths "D:/binarian" --onefile --add-data "D:/binarian/std.bino;."