pyinstaller cant find package Tix

2024/11/15 15:55:36

I am trying to create an executable with pyinstaller for a python script with tix from tkinter. The following script also demonstrates the error:

from tkinter import * 
from tkinter import tixroot = tix.Tk()
root.mainloop()

I have Python 3.9 installed and the script runs fine and works as intended but after using pyinstaller to create an executable, the .exe file fails to run because it can't find the package Tix.

One of the solutions mentioned here which is to copy the C:\Python39\tcl\tix8.4.3 folder to the dist directory for the executable worked for me. The executable runs as intended after copying the folder, but I would like to package the script into one exe without needing to supply the tix8.4.3 folder.

Is there anyway to package the tix folder when building the executable with pyinstaller?

Answer

It works for me using below command to generate the executable:

pyinstaller -F --add-data C:\Python38\tcl\tix8.4.3;tcl\tix8.4.3 main.py

Note that I use PyInstaller 4.7 and Python 3.8.12 under Windows 7.

https://en.xdnf.cn/q/119039.html

Related Q&A

form.validate_on_submit() doesnt work(nothing happen when I submit a form)

Im creating a posting blog function for social media website and Im stuck on a problem: when I click on the "Post" button(on create_post.html), nothing happens.In my blog_posts/views.py, when…

How to find determinant of matrix using python

New at python and rusty on linear Algebra. However, I am looking for guidance on the correct way to create a determinant from a matrix in python without using Numpy. Please see the snippet of code belo…

How do I pass variables around in Python?

I want to make a text-based fighting game, but in order to do so I need to use several functions and pass values around such as damage, weapons, and health.Please allow this code to be able to pass &qu…

How to compare an item within a list of list in python

I am a newbie to python and just learning things as I do my project and here I have a list of lists which I need to compare between the second and last column and get the output for the one which has t…

Make for loop execute parallely with Pandas columns

Please convert below code to execute parallel, Here Im trying to map nested dictionary with pandas column values. The below code works perfectly but consumes lot of time. Hence looking to parallelize t…

Pre-calculate Excel formulas when exporting data with python?

The code is pulling and then putting the excel formulas and not the calculated data of the formula. xxtab.write(8, 3, "=H9+I9")When this is read in and stored in that separate file, it is sto…

Validating Tkinter Entry Box

I am trying to validate my entry box, that only accepts floats, digits, and operators (+-, %). But my program only accepts numbers not symbols. I think it is a problem with my conditions or Python Rege…

Imaplib with GMail offsets uids

Im querying my gmail inbox using pythons ImapLib with a range parameter, but my returned uids are offset from what I request. My request is as follows:M = imaplib.IMAP4_SSL(imap.gmail.com) M.login(USER…

Accessing a folder containing .wav files [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar q…

What is the right Python idiom for sorting by a single criterion (field or key)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 8…