gpt4 book ai didi

python - 我无法运行由 cx_Freeze 构建的电子邮件程序

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:09 25 4
gpt4 key购买 nike

我有一个程序可以像 Python 程序一样完美运行。但是,我尝试将其构建为 cx_Freeze,当我开始发送电子邮件的程序部分时出现错误。 此 Python 中不包含 SSL 支持

我的 setup.py 中有 smtplib,以及所有其他与电子邮件相关的模块。

import sys
from cx_Freeze import setup, Executable

import os
PYTHON_INSTALL_DIR = os.path.dirname(sys.executable)
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

packages = ["smtplib"]
include_files = [(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join('lib', 'tk86t.dll')),
(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), os.path.join('lib', 'tcl86t.dll')),
".env", "message.txt"]

base = None
if sys.platform == 'win32':
base = 'Win32GUI'

executables = [
Executable('boxes.py', base=base, targetName = "SuperbowlBoxesGenerator.exe", icon="icon.ico", copyright="MIT", trademarks="CompuGenius Programs")
]

setup(name='Superbowl Boxes Generator',
version = '2.0',
description = 'An automated generator for the betting game Superbowl Boxes.',
author = "CompuGenius Programs",
options={'build_exe': {'include_files': include_files, 'packages': packages}},
executables=executables)

这是我的 setup.py 脚本。

有人请帮助我。这个程序是为我父亲的生日准备的,由于文件从我的计算机中删除的事实已经过期了,我不得不重写所有内容。

最佳答案

您需要在包中添加ssl,并且

os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libcrypto-1_1-x64.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libssl-1_1-x64.dll'),

包含文件。这是您修改后的 setup.py。

import sys
from cx_Freeze import setup, Executable

import os
PYTHON_INSTALL_DIR = os.path.dirname(sys.executable)
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

packages = ["smtplib", "ssl"]
include_files = [(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join('lib', 'tk86t.dll')),
(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), os.path.join('lib', 'tcl86t.dll')),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libcrypto-1_1-x64.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'libssl-1_1-x64.dll'),
".env", "message.txt"]

base = None
if sys.platform == 'win32':
base = 'Win32GUI'

executables = [
Executable('boxes.py', base=base, targetName = "SuperbowlBoxesGenerator.exe", icon="icon.ico", copyright="MIT", trademarks="CompuGenius Programs")
]

setup(name='Superbowl Boxes Generator',
version = '2.0',
description = 'An automated generator for the betting game Superbowl Boxes.',
author = "CompuGenius Programs",
author_email = "compugeniusprograms@gmail.com",
options={'build_exe': {'include_files': include_files, 'packages': packages}},
executables=executables)

关于python - 我无法运行由 cx_Freeze 构建的电子邮件程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57087219/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com