我有一个可以像Python程序一样完美运行的程序。我尝试将其构建为cx_Freeze,但是当我到达通过电子邮件发送的程序部分时,出现错误。 No SSL support included in this Python
。
我的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脚本。
请帮助我。该程序是我父亲的生日,由于文件已从计算机中删除,因此已经过期,因此我不得不重写所有内容。
答案 0 :(得分:0)
您需要将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)