简体   繁体   English

使用 pyinstaller 时的 pydub“ModuleNotFoundError”

[英]pydub "ModuleNotFoundError" when using pyinstaller

I am trying to convert a .py file to .exe using pyinstaller.我正在尝试使用 pyinstaller 将 .py 文件转换为 .exe。 When I try to run the executable the following error is shown :当我尝试运行可执行文件时,会显示以下错误: 错误

My current pyinstaller command is the following:我当前的 pyinstaller 命令如下:

pyinstaller --noconfirm --onefile --console  --hidden-import "pydub" --add-data "C:/Users/me/AppData/Local/Programs/Python/Python37/Lib/site-packages/customtkinter;customtkinter/"  "C:/Users/me/PycharmProjects/TestProj/main.py"

Try installing it with pip .尝试使用 pip 安装它。

pip3 install pydub

Maybe you have multiple python versions也许你有多个 python 版本

As I already pip installed pydub and added pydub to the hidden imports I tried to delete every file in my Virtual Environment that I didn't need.由于我已经 pip 安装了 pydub 并将 pydub 添加到隐藏的导入中,因此我尝试删除虚拟环境中不需要的每个文件。 Deleting all Pycharm related files and deleting the old build/dist folder alongside the .spec file seems to have fixed the problem.删除所有 Pycharm 相关文件并删除 .spec 文件旁边的旧 build/dist 文件夹似乎已经解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM