1. After packaging the python file (dist and log files do not need to be packaged), upload it to the linux server, under the same directory
Note: Do not pack into zip format, zip will have inconsistent encoding format after uploading from windos to linux for decompression
2. Install the pyinstaller packaging library
pip installer pyinstaller
possible problems
1. Prompt that the pip version is too low
Note: Direct use of sudo pip install -U pip will cause the upgrade to fail due to the large version span.
Use python3 -m pip install --user --upgrade pip==9.0.3 (replace it with what you want Version number) Small-span upgrade
Enter a version number that does not exist, and the version number that can be upgraded can be displayed
3. Input in package linux, pyinstaller startup file.py
As shown in the figure, main.py is my startup file. When packaging, the package associated with main.py will be automatically packaged.
The packaged program is in the dist directory
4. Start under linux
Enter the packaged file directory
execute ./main
5. Other precautions
1. The xlsx file used by pandas is not supported in linux. Change the file suffix to *.xls
2. The pip installation speed is slow. Use a third-party source to install
sudo pip install package name -i https://pypi.tuna.tsinghua. edu.cn/simple/
or # pip install package name -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
or permanently replace pip source reference: https://blog.csdn. net/qq_44716044/article/details/123347432