出口的Python与 “py2exe”,硒错误
问题描述:
我试图出口Python应用程序使用GUI &硒,使用 “py2exe”出口的Python与 “py2exe”,硒错误
setup.py exe文件:
from distutils.core import setup
import py2exe
data_files = [('selenium\\webdriver\\firefox', ['C:\Python34\Lib\site-packages\selenium-2.44.0-py3.4.egg\selenium\webdriver\\firefox\webdriver.xpi']),
('selenium\\webdriver\\firefox', ['C:\Python34\Lib\site-packages\selenium-2.44.0-py3.4.egg\selenium\webdriver\\firefox\webdriver_prefs.json'])]
setup(
name='app',
version='1.0',
console = {'Main.py'}, requires=['easygui', 'selenium'],
data_files=data_files,
)
我得到一个错误 -
FileNotFoundError:[错误2]没有这样的文件或目录:C:\ Python34 \ DIST \ lib中 rary.zip \硒\的webdriver \火狐\ webdriver_prefs.json'
我尝试手动添加文件到拉链,没有工作。
有什么建议吗?
答
您需要配置MANIFEST.in
file:
A MANIFEST.in file can be added in a project to define the list of files to include in the distribution built by the sdist command.
例如,您可以包括所有.json
文件到构建:
recursive-include *.json
另见:
答
我遇到和解决了类似的问题:
- 复制webdriver.xpi和webdriver_prefs.json到你的EXE directoy。
- 修改C:\ Python27 \ LIB \站点包\硒\ webdriver的\火狐\ firefox_profile.py:
更改 “os.path.join(os.path.dirname(文件)”进入 - >“os.path.join(os.path.dirname(文件),'.. \ .. \ .. \ .. \'”,有两个地方。
我有一些麻烦理解这个,我有一个manifest.py,所以我可以输入命令“recursive-include * .json” ? – Bar 2014-12-01 22:58:07
@ user2920421 MANIFEST.in文件有特殊含义,请研究文档和答案链接中提到的,谢谢 – alecxe 2014-12-01 23:02:59