【发布时间】:2015-05-24 02:13:59
【问题描述】:
我的 python 脚本应该导入以下内容:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import *
from selenium.webdriver.common.keys import Keys
from random import uniform
from xlutils.copy import copy
import xlrd
import wx
import os
import shutil
import time
from threading import *
当我使用 Pyinstaller 创建 EXE 时,EXE 无法正常工作。 python脚本运行完美。
这似乎是因为 Pyinstaller 没有包含某些模块。生成的警告文件显示以下内容未导入:
W: no module named xlrd.XL_CELL_EMPTY (top-level import by xlutils.margins)
W: no module named pwd (top-level import by tarfile)
W: no module named xlrd.XL_CELL_TEXT (top-level import by xlutils.margins)
W: no module named readline (delayed import by pdb)
W: no module named xlrd.XL_CELL_NUMBER (top-level import by xlutils.margins)
W: no module named xlrd.open_workbook (top-level import by xlutils.margins)
W: no module named _scproxy (conditional import by urllib)
W: no module named _sysconfigdata (delayed import by distutils.sysconfig)
W: no module named pwd (delayed import by getpass)
W: no module named errorhandler (delayed import by xlutils.filter)
W: no module named EasyDialogs (conditional import by getpass)
W: no module named termios (top-level import by getpass)
W: no module named grp (top-level import by tarfile)
W: no module named xml.dom.XML_NAMESPACE (delayed import by xml.dom.pulldom)
W: no module named gestalt (delayed import by platform)
W: no module named org (top-level import by copy)
W: no module named xlrd.XL_CELL_BLANK (top-level import by xlutils.margins)
W: no module named fcntl (top-level import by tempfile)
W: no module named xml.dom.EMPTY_PREFIX (top-level import by xml.dom.minidom)
W: no module named http (top-level import by selenium.selenium)
W: no module named readline (delayed, conditional import by cmd)
W: no module named elementtree (delayed, conditional import by xlrd.xlsx)
W: no module named xlrd.open_workbook (conditional import by xlutils.margins)
W: no module named java (delayed import by platform)
W: no module named cl (delayed import by aifc)
W: no module named posix (conditional import by __main__)
W: no module named xmlparse (top-level import by pyexpat)
W: no module named posix (conditional import by pyi_os_path)
W: no module named java (conditional import by xml.sax._exceptions)
W: no module named lxml (delayed, conditional import by xlrd.xlsx)
W: no module named ElementC14N (top-level import by xml.etree.ElementTree)
W: no module named xlrd.XL_CELL_TEXT (conditional import by xlutils.margins)
W: no module named _emx_link (conditional import by os)
W: no module named posix (conditional import by os)
W: no module named xml.dom.DOMImplementation (top-level import by xml.dom.domreg)
W: no module named xmltok (top-level import by pyexpat)
W: no module named rourl2path (conditional import by urllib)
W: no module named xlrd.cellname (top-level import by xlutils.margins)
W: no module named pwd (delayed import by webbrowser)
W: no module named xml.dom.EMPTY_NAMESPACE (top-level import by xml.dom.expatbuilder)
W: no module named xml.dom.EMPTY_PREFIX (top-level import by xml.dom.expatbuilder)
W: no module named http (top-level import by selenium.webdriver.remote.remote_connection)
W: no module named SOCKS (top-level import by ftplib)
W: no module named _xmlplus (top-level import by xml)
W: no module named guppy (top-level import by xlutils.filter)
W: no module named http (top-level import by selenium.webdriver.opera.webdriver)`
这是否意味着正在导入 selenium 模块?我很难确定 exe 有什么问题。
【问题讨论】:
标签: python selenium import pyinstaller