<tfoot id='BORmt'></tfoot>

  • <i id='BORmt'><tr id='BORmt'><dt id='BORmt'><q id='BORmt'><span id='BORmt'><b id='BORmt'><form id='BORmt'><ins id='BORmt'></ins><ul id='BORmt'></ul><sub id='BORmt'></sub></form><legend id='BORmt'></legend><bdo id='BORmt'><pre id='BORmt'><center id='BORmt'></center></pre></bdo></b><th id='BORmt'></th></span></q></dt></tr></i><div id='BORmt'><tfoot id='BORmt'></tfoot><dl id='BORmt'><fieldset id='BORmt'></fieldset></dl></div>

      1. <legend id='BORmt'><style id='BORmt'><dir id='BORmt'><q id='BORmt'></q></dir></style></legend>
      2. <small id='BORmt'></small><noframes id='BORmt'>

          <bdo id='BORmt'></bdo><ul id='BORmt'></ul>
      3. 使用 chromedriver &amp; 创建 Python 可执行文件硒

        时间:2023-10-08

          <tbody id='iIOR3'></tbody>
      4. <i id='iIOR3'><tr id='iIOR3'><dt id='iIOR3'><q id='iIOR3'><span id='iIOR3'><b id='iIOR3'><form id='iIOR3'><ins id='iIOR3'></ins><ul id='iIOR3'></ul><sub id='iIOR3'></sub></form><legend id='iIOR3'></legend><bdo id='iIOR3'><pre id='iIOR3'><center id='iIOR3'></center></pre></bdo></b><th id='iIOR3'></th></span></q></dt></tr></i><div id='iIOR3'><tfoot id='iIOR3'></tfoot><dl id='iIOR3'><fieldset id='iIOR3'></fieldset></dl></div>

          <tfoot id='iIOR3'></tfoot>

          <small id='iIOR3'></small><noframes id='iIOR3'>

              <legend id='iIOR3'><style id='iIOR3'><dir id='iIOR3'><q id='iIOR3'></q></dir></style></legend>
                • <bdo id='iIOR3'></bdo><ul id='iIOR3'></ul>
                  本文介绍了使用 chromedriver &amp; 创建 Python 可执行文件硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我使用 Selenium & 创建了一个小型网络抓取应用程序.chromedriver 用于将内容输出到 excel 文件的项目.不幸的是,我为这个应用程序开发的人并不是最精通技术的人.

                  所以我的问题是如何与这些人分享这个应用程序?

                  我查看了 py2exe.org,但它在创建可执行文件时没有考虑到 chromedriver.有没有更好的方法来做到这一点,而这些人不必手动将文件添加到他们的usr/bin"?

                  解决方案

                  你可以在 pyinstaller 的帮助下做到这一点

                  a> :以下是适用于 Windows 的解决方案,但 pyinstaller 表示它也可以在 Mac OS 上运行.

                  步骤是:

                  1. 打开命令提示符
                  2. 转到 cmd 中存在脚本的项目路径
                  3. 键入 pyinstaller Scriptname.spec Scriptname.py(如果屏幕上出现提示,请输入 y/yes)
                  4. 构建将位于项目路径"distScriptname

                  注意,传递时需要在Scriptname.spec中提供chromedriver的详细信息

                  spec 文件的示例内容:

                  # -*- 模式:python -*-block_cipher = 无a = 分析(['Scriptname.py'],pathex=['Pathofproject'],二进制文件=[('C:\Python27\chromedriver.exe', '**.\selenium\webdriver**')],数据=[],隐藏进口=[],钩子路径=[],runtime_hooks=[],排除=[],win_no_prefer_redirects=假,win_private_assemblies=假,密码=块密码)pyz = PYZ(a.pure, a.zipped_data,密码=块密码)exe = EXE(pyz,a.脚本,exclude_binaries=真,name='createEVIPorg_Automation_new',调试=假,条=假,upx=真,控制台=真)科尔=收集(exe,a.二进制文件,a.zip 文件,a.数据,条=假,upx=真,name='**脚本名**')

                  您需要更新脚本名称、脚本所在的项目路径、spec 文件中 chromedriver 的路径

                  I have created a small web scraping app using Selenium & chromedriver for a project that outputs the content into an excel file. The people I did this app for unfortunately aren't the most tech-savvy.

                  So my question is how can I share this app with these people?

                  I looked into py2exe.org, but it doesn't take the chromedriver into account when creating the executable. Any better ways of doing this, without these people having to add the files manually to their "usr/bin"?

                  解决方案

                  You can do this with the help of pyinstaller : Below is the solution which work on Windows but pyinstaller says its capable of working on Mac OS also.

                  Steps are:

                  1. Open Command prompt
                  2. Goto project path in cmd where script is present
                  3. type pyinstaller Scriptname.spec Scriptname.py (Enter y/yes if prompt on screen)
                  4. The build will be at 'path to project'distScriptname

                  Note you need to provide the details of chromedriver in Scriptname.spec when passing the

                  Sample content of spec file:

                  # -*- 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**')
                  

                  You need to update the Scriptname, project path where you script lies, path of chromedriver in spec file

                  这篇关于使用 chromedriver &amp; 创建 Python 可执行文件硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:通过 Selenium Python 在正常/无头模式下使用 Chrome 下一篇:WebDriverException:消息:“无法连接到 ChromeDriver&quo

                  相关文章

                  最新文章

                  1. <small id='Nuayo'></small><noframes id='Nuayo'>

                  2. <tfoot id='Nuayo'></tfoot>
                      <bdo id='Nuayo'></bdo><ul id='Nuayo'></ul>
                  3. <i id='Nuayo'><tr id='Nuayo'><dt id='Nuayo'><q id='Nuayo'><span id='Nuayo'><b id='Nuayo'><form id='Nuayo'><ins id='Nuayo'></ins><ul id='Nuayo'></ul><sub id='Nuayo'></sub></form><legend id='Nuayo'></legend><bdo id='Nuayo'><pre id='Nuayo'><center id='Nuayo'></center></pre></bdo></b><th id='Nuayo'></th></span></q></dt></tr></i><div id='Nuayo'><tfoot id='Nuayo'></tfoot><dl id='Nuayo'><fieldset id='Nuayo'></fieldset></dl></div>
                  4. <legend id='Nuayo'><style id='Nuayo'><dir id='Nuayo'><q id='Nuayo'></q></dir></style></legend>