作者:赖皮小王子 | 来源:互联网 | 2023-05-18 07:28
Ivelookedeverywhere.Stackoverflow,variousmessageboards,thepy2exewebsite,thepyinstallerwe
I've looked everywhere. Stackoverflow, various messageboards, the py2exe website, the pyinstaller website...nothing is helping. Including the selenium module, particularly making an exe that supports firefox, seems impossible. I am starting to pull out my hair because using either py2exe and pyinstaller is becoming a huge headache.
我已经找遍了所有的地方。Stackoverflow,各种留言板,py2exe网站,pyinstaller网站……没有帮助。包括selenium模块,特别是支持firefox的exe,似乎是不可能的。我开始拔掉我的头发,因为使用py2exe和pyinstaller都变得非常头疼。
Both py2exe and pyinstaller have their share of problems.
py2exe和pyinstaller都有自己的问题。
My goal is to make one single exe file, without any extra directories, so that other people can use my program if they do not have python/modules.
我的目标是创建一个单独的exe文件,不包含任何额外的目录,以便其他人可以在没有python/模块的情况下使用我的程序。
With py2exe, if I create a setup.py file as such
用py2exe,如果我创建一个设置。py文件等
from distutils.core import setup
import py2exe
setup(
name='Ask Alfred',
data_files = [('Drivers', ['Drivers/chromedriver.exe',
'Drivers/webdriver.xpi','Drivers/webdriver_prefs.json'])],
version='1.0',
description='Find emails fast!',
author='Me',
windows=[{'script': 'alphy.py'}],
optiOns={
'py2exe':
{
'skip_archive': False,
'optimize': 2,
}
}
)
it will create an exe in the dist folder and a Drivers folder with the files I need, however, if I try to run the exe it will tell me that it could not find these files (because it is looking for them in the library.zip folder). On top of that, my GUI looks terrible (fonts are now grey instead of black and images with white backgrounds now have grey backgrounds).
它将在dist文件夹中创建一个exe和一个驱动程序文件夹,其中包含我需要的文件,但是,如果我试图运行exe,它会告诉我它找不到这些文件(因为它正在库中查找它们)。压缩文件夹)。最重要的是,我的GUI看起来很糟糕(字体现在是灰色的,而不是黑色的,背景是白色的图片背景是灰色的)。
With pyinstaller, if I use the "--onefile" flag when creating the exe it does not work at all/neither firefox nor chrome gets started.
使用pyinstaller,如果我在创建exe时使用“-onefile”标志,那么它根本不能工作/ firefox和chrome都不能启动。
With either, I only get workable results if I choose to not archive/not make one file. In that case, pyinstaller delivers a fully working solution.
只有当我选择不归档/不制作一个文件时,我才能得到可行的结果。在这种情况下,pyinstaller提供了一个完整的工作解决方案。
1 个解决方案