The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in E:\app_data\Anaconda\Lib\site-packages) using
conda remove
then try again.
出现以上问题。
解决方法:
1、用管理员打开cmd;
2、python -m pip install pyinstaller
3、 cd到python文件路径下输入:pyinstaller -F -w -i camera.ico PengCam_recover.py
4、弹出错误
5、pip uninstall pathlib然后点y
6、重复输入pyinstaller.exe -F -w -i camera.ico PengCam_recover.py
7、成功安装。这里我放了一个图标camera.ico
实际上并不是很完美。后来参考Python脚本打包成exe,看这一篇就够了!_python 打包-CSDN博客
这个文章通过建立虚拟环境打包,简单便携,生成的程序文件也没有什么问题。