Error in pyinstall package Python program: jinja2.exceptions.templatenotfound: Chart_ Solution to component.html

Recently, I wrote a visualization program in Python and used the daopycharts Library in the middle. There is no problem running it alone. However, after using pyinstall to package it into a separate EXE file, the running program reported an error: jinja2.exceptions.templatenotfound: chart_ component.html

After searching for relevant information on the Internet, it is said that pyinstaller and pyecarts are incompatible. The solutions after trying are as follows:

1. Change the packaging method and use the – D parameter to package it into a file instead of using the – f parameter to package it directly into an EXE file

as   pyinstaller -D -p d:\path run.py

-p   d: \ path is the site packages path of the imported package in your file. If the path of the pyecarts library on the computer is C: \ Python 37 \ lib \ site packages, it is written here as – P   C:\Python37\Lib\site-packages

Run.py is the target entry file that needs to be packaged

2. After pyinstaller is packaged, it will generate two folders: build and dist. open the dist folder and copy the pyecarts folder under C: \ Python 37 \ lib \ site packages to this directory

Run the packaged exe program, and the error message disappears

Read More: