如何使用pmw将.py转换为.exe? [英] How can I convert a .py to .exe using pmw?

查看:43
本文介绍了如何使用pmw将.py转换为.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Python 3.8中构建一个GUI程序,我想将Python程序转换为可执行文件,它始终有效.但是由于我正在使用Python megawidget,所以我无法再打开exe文件.

我猜问题出在安装pmw的地方.我做了"pip install pmw",它说要求已经满足",但是如果我查看模块,则没有pmw.

我在做什么错了?

解决方案

首先,该错误是由于Pmw使用了惰性导入造成的,要修复该错误,请尝试转到 解决方案

First of all the error is due to Pmw using a lazy import, to fix it try going to this link and then copy the entire code and create a new file in your project directory(where the python script is located) and then name it Pmw.py and then paste this entire code in that file. After that, just just try making an exe. It should work for Pmw.ScrolledText(). I had the issue with Pmw.Balloon() and this fixed it.

Naming the file to Pmw.py overrides the import Pmw statement in your code and now this Pmw file is used, which should fix your error with pyinstaller.

NOTE: If you are not using other modules like PmwColor or PmwBlt then make sure to remove the first 10 lines there(which imports those files).

这篇关于如何使用pmw将.py转换为.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆