pyinstaller 打包后报错 ModuleNotFoundError: No module named ‘***‘ 最简单解决方案

news/2024/7/24 9:40:53 标签: bug

先上方案

在代码中加入 import ***,例如:

我的错误为 ModuleNotFoundError: No module named 'bottle_websocket',
解决方案为 在源代码主程序中添加一行, import bottle_websocket,问题解决.

原因分析

一般情况下出现问题是因为某个module引用了其他的module,造成pyinstaller分析不出依赖.加入import *** 就显示告诉pyinstaller我用了这个module,你要给我打包进去.

备用方案

在.spec文件中 hiddenimports项中加入依赖的module.

参考:

https://www.cnblogs.com/aloe-n/p/10404711.html

https://www.cnblogs.com/semishigure/p/10477288.html


http://www.niftyadmin.cn/n/957450.html

相关文章

RuntimeError: No such operator torchvision::nms

引用:https://blog.csdn.net/weixin_43218120/article/details/108646001 RuntimeError: No such operator torchvision::nms 此bug是自己使用pyinstaller编译使用yolov5进行目标识别的代码中产生的问题,在python环境中代码可以正常运行,但…

pyinstaller打包移植到别的电脑报错OSError: [WinError 126] 找不到指定的模块。

首先说一下我的环境 win10 python3.6.4 下面是我安装库 版本 pip list Package Version --------------- -------------- altgraph 0.15 certifi 2018.4.16 chardet 3.0.4 future 0.16.0 GDAL 2.2.4 graphviz 0.…

Python安装tar.gz格式文件方法详解

这篇文章主要介绍了Python安装tar.gz格式文件方法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 有的库没有找到对应的.whl格式文件,只有.tar.gz格式文件,接下来总结下该类型文件的…

鼠标悬停标签切换内容js

<!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Tab效果</title><style type"text/css">ul{list-style: none;}*{margin: 0;padding: 0;}#tab{border: 1px solid #ccc;margin: …

WARNING: file already exists but should not: C:\Users\workAI\AppData\Local\Temp\_MEI132522\torch\_C

此bug是使用pyinstaller编译文件为exe文件中产生的&#xff0c;具体如下&#xff1a; WARNING: file already exists but should not: C:\Users\workAI\AppData\Local\Temp\_MEI132522\torch\_C述bug在编译和运行过程中没有产生影响&#xff0c;但是自己在偶然的原因不知不觉的…

PyQt5基本窗口控件-----QRadioButton

PyQt5学习之路&#xff0c;点击有pyqt5学习笔记 QRadioButton类提供了一组可供选择的按钮和文本标签&#xff0c;为用户提供多选一的操作。 import sys from PyQt5.QtWidgets import *class QRadioButtonDemo(QWidget):def __init__(self):super(QRadioButtonDemo, self).__in…

算法学习(一)——Minimax算法

作者&#xff1a;还想养只小短腿 链接&#xff1a;https://www.zhihu.com/question/27221568/answer/140874499 来源&#xff1a;知乎 著作权归作者所有。商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处。 先来说极小极大算法主要应用于什么样的游戏&#xff…

算法学习(二)——Alpha-Beta剪枝算法

参考&#xff1a;https://blog.csdn.net/weixin_42192933/article/details/105873866 剪枝流程 这里以流程图来表述 图中红 线 \textcolor{Red}{红线}红线代表被剪枝的部分,蓝 线 \textcolor{Blue}{蓝线}蓝线代表流程,正方形代表maximum,圆形代表minimum 剪枝算法内部旨在求α…