Toss a day to meet a few headache problem, fortunately go back before the settlement lost
The first: Execute Cxfreeze packaged program encountered Tkinter and _tkinter missing issues
First Terminal: Python tkinter
Python _tkinter
Print (Tkinter)
Print (_tkinter)
Locate the two packages and copy them to the Cxfreeze packaged directory
The next step is to prompt:
First look at the system has not installed TK tcl. No words: yum-y install tkinter tcl-devel tk-devel
If there is.
import tkinter
root = tkinter.Tk()
print(root.tk.exprstring(‘$tcl_library‘))
print(root.tk.exprstring(‘$tk_library‘))
Find the installation location of Tcl and TK
Add such a few words to the setup.py:
os.environ[' tcl_library '] = "usr/share/tcl8.5"
os.environ[' tk_library '] = "usr/share/tk8.5"
os.environ[" TKPATH
] =" usr/share/tk8.5 "
RePack python setup.py Install
Run the executable program again to error:
This time even the error message is not very uncomfortable, tossing an afternoon almost give up, the last chance to find is the problem of the path, packaged file path name contains "document/" contains Chinese characters
Try to change a plain English path name success!
Then encountered a more uncomfortable problem, matplotlib program in the Linux terminal execution, no desktop environment, error:
Workaround:
Import Matplotlib.pyplot as plt followed by a sentence plt.switch_backend ("agg")
Test on a local virtual machine to view and close the Centos7 graphical interface:
To view the default target, execute: systemctl get-default Boot in command mode, execute: systemctl set-default multi-user.target boot with graphical interface, execute: SYSTEMCTL Set-default Graphical.target
Problem solving, a painful and happy day
CENTOS7/REDHAT7 Python3 use Cx-freeze packaging matplotlib programs encountered problems and solutions