我在praw、cx\u freeze、pyside和requests方面遇到了问题,在冻结之前一切都正常,但是当我冻结时,requests出现了问题,我想: http://pastie.org/10614254
这是我正在处理的项目:https://github.com/MrCappuccino/WallDit-QT
这是我的设置.py:https://gist.github.com/MrCappuccino/0f1b0571d29d47a95895
import sys
import cx_Freeze
import PySide
import praw
import requests.certs
from cx_Freeze import setup, Executable
exe = Executable(
script="WallDit_QT.py",
base="Win32GUI",
targetName="WallDit_QT.exe"
)
#includefiles = ['README.txt', 'CHANGELOG.txt', 'helpers\uncompress\unRAR.exe', , 'helpers\uncompress\unzip.exe']
#build_exe_options = {"packages": ["os"], "includefiles": ['README.txt', 'CHANGELOG.txt']}
setup(name = 'WallDit_QT',
version = '1.0',
author = 'Disco Dolan',
description ='Set your wallpaper interactively!',
executables = [exe],
options = {'build.exe': {"include_files":['cacert.pem', 'praw.ini', 'README.md']}},
requires = ['PySide', 'cx_Freeze', 'praw', 'shutil', 'requests']
)
有人能帮忙吗?你知道吗
我试过添加cacert.pem公司,无济于事,在这一点上我没有更多的想法
对于某些冻结的应用程序,必须在冻结的应用程序中设置cacert(或通常的外部数据)路径。你知道吗
设置.py章节
首先需要将其包含在构建选项中,并手动指定安装目录。这是唯一一个进入设置.py地址:
在您的情况下,这将生成以下安装文件:
应用程序部分
然后需要在运行时在冻结的应用程序中获取证书路径。 对于PyInstaller,在运行时定义了一个路径,指向名为\u MEIPASS的数据目录(可以从sys.\u MEIPASS获得),允许您访问应用程序所需的所有数据。如果是cacert.pem公司,路径确定如下:
对于cx\u Freeze,可以从安装的路径确定路径,并将其与所需的数据连接起来。在这里,我们得到如下路径:
您可以通过以下方式轻松获取冻结应用程序的数据目录:
(请注意,这不适用于非冻结的应用程序,因此为了确保它同时适用于冻结和非冻结的应用程序,Cx_Freeze recommends您可以按如下方式对其进行编码):
然后将此路径包括在“所有请求”模块获取和发布请求中,如下所示:
例1
示例代码段如下所示:
例2
您还可以通过执行以下操作来告诉请求将来在何处查找证书:
在这种情况下,我们将执行以下操作。这里的优点是cacertpath不需要在每个模块中显式定义(或者从另一个模块导入),可以在环境中定义。你知道吗
相关问题 更多 >
编程相关推荐