我的脚本里引入了两个第三方库player和openpyxl
from openpyxl import load_workbook
from plyer import notification
一开始使用pyinstaller main.py打包过后,在cmd中运行main.exe报错
ModuleNotFoundError: No module named 'plyer.'
在了资料之后,用了以下办法:
- 加上第三方库的路径:pyinstaller main.py -P xxxxxxxx
- 在pyinstaller文件的hooks文件里加上了hook-player.py和hook-openpyxl.py文件
最后运行报错变成了
Traceback (most recent call last):
File "plyer\utils.py", line 93, in _ensure_obj
ModuleNotFoundError: No module named 'plyer.platforms'
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "plyer\facades\notification.py", line 79, in notify
File "plyer\facades\notification.py", line 88, in _notify
NotImplementedError: No usable implementation found!
[2816] Failed to execute script 'main' due to unhandled exception!
求解答.