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:
- The problem of failed to create process occurs in pyinstaller package program of Python
- Python program uses OS. System () method to call exe program, resulting in no response of main program process
- No matching distribution found for exceptions when Python installs docx package
- #An error is reported by the chart map component of renfast framework
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- Chart.min.js:10 Failed to create chart: can’t acquire context from the given item
- Python uses cxfree to package script files into executable programs
- Package python3.1 + PyQt4 into exe
- Record the python package EXE file running error importerror, but do not prompt specific error solution
- (Copy python package, the problem generated) pip Fatal error in launcher: Unable to create process using
- A solution to the problem of “straight ‘\ 357’ in program” when compiling GCC
- Solution to stray’\357′ in program when gcc is compiled
- Solution of no response of progress bar in MFC program
- Python MAC installation mysqlclient package error “error: Command ‘clang’ failed with exit status 1” solution
- Python Mac installs mysqlclient package error “error: command’clang’ failed with exit status 1” solution
- [Vue warn]: Do not use built-in or reserved HTML elements as component id: article
- Perfect solution to raise runtimeerror (“distributed package doesn’t have nccl”) in Windows system“
- Python – [encoding] in Python os.system Solution to Chinese garbled code when calling CMD command
- Error: the solution of “241” and “343” in program
- [HTML] Python extracts HTML text to TXT