Python cx_Freeze on Windows 10 gives IOError: [Errno 9] Bad File descriptor

Python cx_Freeze on Windows 10 gives IOError: [Errno 9] Bad File descriptor

我有一个 selenium python 2.7 应用程序可以在不同的网站上搜索航班。我用 cx_freeze 创建了一个可执行文件,它在 Windows 7 上运行完美,但在 Windows 10.

上给出了这个错误

这是错误:

这是我的 setup.py:

import sys
import os
from cx_Freeze import setup, Executable
exe = Executable(
script=r"selenium_start.py",
base="Win32GUI",
appendScriptToExe = True,
appendScriptToLibrary = True, 
)

setup(
name = "GoPepper Search Tool",
version = "0.1",
description = "GoPepper Search Tool",
options = {"build_exe": {"create_shared_zip": True,"append_script_to_exe": True, "packages": ["selenium"]} },
executables = [exe]
)

这就是我创建可执行文件后的文件夹结构。 webdriver json 文件有问题,但我在这里找到了一个解决方案,它说将整个 selenium 文件夹复制到带有 .exe 的文件夹中(我不知道这是否会导致 windows 上出现问题10).

windows10的笔记本是全新的,没有安装python等,会不会是这个问题?但实际上一个 exe 必须在没有任何东西的情况下工作?谢谢!

好的,我解决了这个问题。

我必须下载 Mozilla Firefox 浏览器才能访问其二进制文件。

注意:在我解决之前,我也在新笔记本上安装了相同的python版本,还导入了selenium等,但并没有解决问题。我必须下载 Firefox 浏览器。

现在它也适用于 Windows10。