Search code examples
pythonpython-3.xpyinstallerauto-py-to-execustomtkinter

Py installer issue


I want to extract my python script to exe file I am using a lot of packeges but customtkinter is different you have to do like this

and my command is this

pyinstaller --noconfirm --onefile --windowed --icon "C:/Users/pc/Desktop/main_icon.ico" --name "Automated gmail" --add-binary "c:\users\pc\appdata\local\programs\python\python310\lib\site-packages\customtkinter;.customtkinter\" --add-data "C:/Users/pc/Desktop/main_icon.ico;." --add-data "C:/Users/pc/Desktop/paper-plane.png;."  "C:/Users/pc/Desktop/example.py"

but it shows this when I run the command

pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: 'c:\\users\\pc\\appdata\\local\\programs\\python\\python310\\lib\\site-packages\\customtkinter;.customtkinter" --add-data C:/Users/pc/Desktop/main_icon.ico;. --add-data C:/Users/pc/Desktop/paper-plane.png;.  C:/Users/pc/Desktop/example.py'

I hope someone to help me

i tried to google some solutions and youtube videos


Solution

  • You are putting a . in front of the destination address, and you want to use the --add-data not --add-binary arguments. You can leave the . there just put a path seperator in front of it.

    Try:

    pyinstaller --noconfirm --onefile --windowed --icon C:/Users/pc/Desktop/main_icon.ico --name "Automated gmail" --add-data C:/Users/pc/AppData/local/programs/python/python310/lib/site-packages/customtkinter;./customtkinter --add-data C:/Users/pc/Desktop/main_icon.ico;. --add-data C:/Users/pc/Desktop/paper-plane.png;.  C:/Users/pc/Desktop/example.py