【问题标题】:Python cx_Freeze on Windows 10 gives IOError: [Errno 9] Bad File descriptorWindows 10 上的 Python cx_Freeze 给出 IOError: [Errno 9] Bad File descriptor
【发布时间】:2016-04-15 16:36:18
【问题描述】:

我有一个 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出现问题)。

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

【问题讨论】:

    标签: python windows python-2.7 selenium cx-freeze


    【解决方案1】:

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

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

    注意:在我解决之前,我还在新笔记本上安装了相同的python版本,还导入了selenium等。但它没有解决问题。我不得不下载火狐浏览器。

    现在它也适用于 Windows 10。

    【讨论】:

    • 它似乎试图将关于找不到 Firefox 的错误写入sys.stderr,但它没有 stderr,因为没有命令提示符窗口。您也许可以覆盖 Tkinter.Tk.report_callback_extension 以对错误进行更有用的操作。
    猜你喜欢
    • 2011-12-02
    • 2019-08-19
    • 1970-01-01
    • 2021-12-05
    • 1970-01-01
    • 2023-03-31
    • 2021-12-20
    • 1970-01-01
    • 2023-01-24
    相关资源
    最近更新 更多