use*_*900 5 python selenium executable selenium-chromedriver
我使用 Selenium 和 chromedriver 创建了一个小型网络抓取应用程序,用于将内容输出到 excel 文件的项目。不幸的是,我为这个应用程序设计的人并不是最精通技术的人。
所以我的问题是如何与这些人分享这个应用程序?
我查看了 py2exe.org,但在创建可执行文件时它没有考虑 chromedriver。有没有更好的方法来做到这一点,而这些人不必手动将文件添加到他们的“usr/bin”中?
您可以在pyinstaller的帮助下完成此操作:以下是适用于 Windows 的解决方案,但 pyinstaller 表示它也可以在 Mac OS 上工作。
步骤是:
请注意,您需要在传递 Scriptname.spec 时提供 chromedriver 的详细信息
规范文件的示例内容:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['Scriptname.py'],
pathex=['Pathofproject'],
binaries=[('C:\\Python27\\chromedriver.exe', '**.\\selenium\\webdriver**')],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='createEVIPOrg_Automation_new',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='**scriptname**')
Run Code Online (Sandbox Code Playgroud)
您需要更新脚本名称、脚本所在的项目路径、规范文件中 chromedriver 的路径
| 归档时间: |
|
| 查看次数: |
8878 次 |
| 最近记录: |