cx_Freeze 错误模块 SSL 不可用 Python 3.7 Windows 10
Posted
技术标签:
【中文标题】cx_Freeze 错误模块 SSL 不可用 Python 3.7 Windows 10【英文标题】:cx_Freeze error module SSL not available Python 3.7 Windows 10 【发布时间】:2018-09-26 13:31:08 【问题描述】:我用 Python 3 编写了一个程序来制作一个 Bot 到 Crypto 货币的板。该程序运行良好,没有错误,但使用 cx_Freeze 我在使用 coinmarketcap 查询时出现错误,错误是 SSL 模块丢失。
import sys
from cx_Freeze import setup, Executable
import os
import requests.certs
packages = ["tkinter", "requests", "idna", "queue", "coinmarketcap", "requests_cache", "PIL", "urllib3", "OpenSSL", "ssl", "arrow", "tempfile", "json", "locale", "C:\\Users\\cavaud\\Desktop\\botTKinker\\config", "time", "sys", "mysqldb", "urllib.request"]
includeFile = [requests.certs.where(), "cacert.pem", "ico24x24.ico" , "bas.png", "haut.png", "egal.png", "level.png", "logoBotV2H2.png", "orderNOK.gif", "orderOK.gif", "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs\\tcl86t.dll", "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs\\tk86t.dll"]
path = sys.path
os.environ['TCL_LIBRARY'] = "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\tcl\\tk8.6"
os.environ['REQUESTS_CA_BUNDLE'] = "cacert.pem"
base = None
if sys.platform == "win32":
base = "Win32GUI"
options = "path": path,
"includes": includeModule,
"include_files": includeFile,
"packages" : packages,
"silent": False
options["include_msvcr"] = True
cible_1 = Executable(
script="botTK.py",
base=base,
icon="ico24x24.ico"
)
setup(
name="BotTK",
version="1.00",
description="BOT TK",
author="moi",
options="build_exe": options,
executables=[cible_1]
)
谢谢
【问题讨论】:
向上向上向上向上向上向上! 【参考方案1】:尝试如下修改您的setup.py
脚本:
includeFile = [(requests.certs.where(), "cacert.pem"), "ico24x24.ico" , "bas.png", "haut.png", "egal.png", "level.png", "logoBotV2H2.png", "orderNOK.gif", "orderOK.gif", "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs\\tcl86t.dll", "C:\\Users\\cavaud\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs\\tk86t.dll"]
(请注意前两个条目的括号!)和
os.environ['REQUESTS_CA_BUNDLE'] = os.path.join(os.getcwd(), "cacert.pem")
见Requests library: missing SSL handshake certificates file after cx_Freeze
【讨论】:
@MichelBlogdeMichel 你试过这个答案吗?请向投入时间试图帮助您的人们提供反馈。这是他们应得的最低限度,特别是考虑到您已经在这里和cx_Freeze repository 上打开了一个问题,并试图在这两个地方使用无意义的“UP”cmets 来获得更多关注。以上是关于cx_Freeze 错误模块 SSL 不可用 Python 3.7 Windows 10的主要内容,如果未能解决你的问题,请参考以下文章
cx_Freeze:Python 错误主脚本。找不到模块错误:没有名为 pygments.lexers.python 的模块
“pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用”