【发布时间】:2022-02-15 00:48:50
【问题描述】:
我需要将我的 python 代码编译为 .exe 以供用户分发。我正在尝试pyinstaller - 工作正常,但 Win Defender 将生成的 .exe 阻止为病毒。我尝试several things 来避免它,但没有成功。
所以现在我尝试使用 py2exe 实用程序。我管理它像这样运行(这应该是一个文件):
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
console = ["myApp.py"],
zipfile = None,
)
编译正常,我什至可以从 dist 文件夹运行它,但是一旦我将 .exe 移动到不同的位置,它就会给我错误:
AttributeError: module 'http.client' has no attribute 'HTTPSConnection'. Did you mean: 'HTTPConnection'?
Http 是 myApp 中使用的模块。
这是 dist 文件夹的内容:
【问题讨论】:
标签: python pyinstaller py2exe