下载pyinstaller
pip install pyinstaller
1
打包文件
pyinstaller -F run.py # 打包成单个文件
1
常见报错
bash
(base) D:\BaiduSyncdisk\wangzhangkai\scripts>Pyinstaller -F -w -i favicon.ico test.py
The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in C:\ProgramData\anaconda3\Lib\site-packages) using
conda remove
then try again.
(base) D:\BaiduSyncdisk\wangzhangkai\scripts>pip uninstall pathlib
Found existing installation: pathlib 1.0.1
Uninstalling pathlib-1.0.1:
Would remove:
c:\programda
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
必须是管理员权限打开的终端:
bash
C:\Windows\System32>pip uninstall pathlib
Found existing installation: pathlib 1.0.1
Uninstalling pathlib-1.0.1:
Would remove:
c:\programdata\anaconda3\lib\site-packages\pathlib-1.0.1.dist-info\*
c:\programdata\anaconda3\lib\site-packages\pathlib.py
Proceed (Y/n)? y
Successfully uninstalled pathlib-1.0.1
C:\Windows\System32>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10