无法将 webbot 脚本转换为可执行文件 [英] can't convert webbot script to an executable

查看:32
本文介绍了无法将 webbot 脚本转换为可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试转换使用 webbot 库进行网络自动化的 python 脚本.

I am trying to convert a python script which uses the webbot library for web automation.

当我尝试使用 pyinstaller 将我正在运行的 Python (3.6.5) 脚本转换为 .exe 文件时,我收到一个错误,提示找不到 webbot 模块的路径.

As I tried to convert my running Python (3.6.5) script to an .exe file using pyinstaller I was getting an error that the path of the webbot module could not be found.

为了克服这个问题,我尝试在spec文件中指定模块的路径,但没有成功.一个更简单的解决方法是将下载的文件夹 webbot 复制到 .exe 文件所在的同一文件夹中.

In order to overcome this problem I tried to specify the path of the module in the spec file, without success. An easier workaround suggests copying the downloaded folder webbot in the same folder where the .exe file is.

这是一个非常方便使用的工具,我不想放弃它.

Its a very handy tool to use , i don't wanna ditch it .

推荐答案

为了使其正常工作,您不应该像这样将其转换为一个文件

In order for this to work you should not convert it as one file like this

pyinstaller --onefile file.py

但是像这样

pyinstaller file.py

执行此操作后,.exe 可以毫无问题地启动.

After doing this the .exe could be launched without any problems.

另一个错误是因为尝试在我的脚本中导入 webbot.可能这是一个菜鸟错误,但必须要:

An other error was coming because of trying to import webbot in my script. Probably this is a noob mistake, but one has to:

from webbot import Browser

这篇关于无法将 webbot 脚本转换为可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆