Python 已编译的py2exe应用程序中缺少文件

Python 已编译的py2exe应用程序中缺少文件,python,selenium,py2exe,Python,Selenium,Py2exe,我正在尝试让我的Selenium应用程序正常工作。它可以编译所有内容,但当我打开应用程序时,它会告诉我: C:\Python34\dist>browse.exe Traceback (most recent call last): File "browse.py", line 9, in <module> File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 43,

我正在尝试让我的Selenium应用程序正常工作。它可以编译所有内容,但当我打开应用程序时,它会告诉我:

C:\Python34\dist>browse.exe
Traceback (most recent call last):
File "browse.py", line 9, in <module>
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 43, in __init__
self.profile = FirefoxProfile()
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_profile
.py", line 64, in __init__
WEBDRIVER_PREFERENCES)) as default_prefs:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Python34\\dist\\lib
rary.zip\\selenium\\webdriver\\firefox\\webdriver_prefs.json'
检查原始答案:


您必须手动将webdriver.xpi和webdriver\u prefs.json从C:\Python27\Lib\site packages\selenium\webdriver\firefox复制到dist\selenium\webdriver\firefox

这有效:编辑firefox\u profile.py:webdriver\u EXT,webdriver\u首选项:

如果getattrsys为“冻结”,则为False:WEBDRIVER\u EXT=os.path.joinos.path.dirnamesys.executable,WEBDRIVER.xpi WEBDRIVER\u PREFERENCES=os.path.joinos.path.dirnamesys.executable,WEBDRIVER\u prefs.json elif文件:WEBDRIVER\u EXT=os.path.joinos.path.dirnamefile,WEBDRIVER.xpi WEBDRIVER\u PREFERENCES=os.path.joinos.path.dirnamefile,WEBDRIVER\u prefs.json


转到打开的线路。。。。替换为openWEBDRIVER_首选项作为默认_首选项

您是否找到了答案,因为我也遇到了同样的错误。你在下面选择的答案对他们没有帮助。你到底在哪里编辑这个文件的?哪个文件夹?
from distutils.core import setup
import py2exe

setup(
console=['browse.py'],
options={
        "py2exe":{
                "skip_archive": True,
                "unbuffered": True,
                "optimize": 2
        }
}
)