使用PyInstaller创建EXE:EXE无法正常工作/不导入多个模块

时间:2015-05-24 02:13:59

标签: python selenium import pyinstaller

我的python脚本应该导入以下内容:

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)`  

当我使用Pyinstaller创建EXE时,EXE无法正常工作。 python脚本运行完美。

这似乎是因为Pyinstaller没有包含一些模块。生成的警告文件说明未导入以下内容:

private void button1_Click(object sender, System.EventArgs e)
{
}

这是否意味着硒模块正在进口?我很难确定exe的错误。

1 个答案:

答案 0 :(得分:-1)

我认为Selenium被认为是一个外部模块,因此您需要通过添加一个钩子文件来指定它的路径。 看看这个tutorial如何使用正确的路径设置钩子文件。查看“使用外部模块”。