Windows 10上的Python cx_Freeze给出IOError:[Errno 9] Bad File描述符

时间:2016-01-11 11:25:57

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

我有一个selenium python 2.7应用程序,用于搜索不同网站上的航班。我使用cx_freeze创建了一个可执行文件,它在Windows 7上运行良好,但在Windows 10上出现此错误。

这是错误: enter image description here

这是我的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]
)

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

用Windows 10的笔记本是全新的,没有安装python等,这会引起问题吗?但实际上一个exe必须没有任何工作吗?谢谢!

1 个答案:

答案 0 :(得分:0)

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

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

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

现在它也适用于Windows 10.