Pyinstaller:OSError:无法从路径加载 AutoItX [英] Pyinstaller: OSError: Cannot load AutoItX from path

查看:34
本文介绍了Pyinstaller:OSError:无法从路径加载 AutoItX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个程序,每当我从命令行启动它时,它都可以正常工作.我现在需要的是一个可执行文件,因此我尝试使用 pyinstaller 来完成它,它通常会自动分析已导入哪些模块,并且它可以与除 autoit 之外的所有模块一起正常工作.我的导入方式如下:

So I have a program and whenever I start it from the command line it works totally fine. What I need now is an Executable and therefor I tried to do it with pyinstaller, which analyzes normally automatically which modules have been imported and it works fine with all of the modules except for autoit. The way I import it looks like that:

import autoit

所以我尝试通过以下命令制作一个可执行文件:

So I tried to make an executable by following command:

pyinstaller --onefile ./rocketupload.py

这给了我这个错误(对不起,我必须截图,但窗口打开了一秒钟然后立即关闭,所以我无法在这里复制和粘贴它):

Which gave me this Error (Excuse me, that I have to make a screenshot, but the window was open for a second and closed immediately afterwards, so I was not able to copy and paste it here):

通过将 autoit dll 复制到错误中提到的路径,我能够创建一个正常运行的 exe,但这只是一个临时解决方案,因为我希望可执行文件不仅在我的 PC 上运行.

I was able to create a functioning exe by copying the autoit dll to the path mentioned in the Error, but that is just a temporary solution, since I want the executable to be running not only on my PC.

我也试过这个,但没有成功:

I've also tried this one without succes:

pyinstaller --hidden-import=autoit --onefile --paths c:userssemjoappdatalocalprogramspythonpython37libsite-packagesautoitlib .
ocketupload.py

所以这里的问题是 autoit 模块没有从 pyinstaller 复制,所以它不能按预期运行可执行文件.但是我不知道如何解决它,以便exe可以按预期运行.希望你能在这里帮助我,现在试图找到几个小时的解决方案......

So the problem here is that the autoit module does not get copied from pyinstaller so It cannot run the executable as inteded. But I dont know how to solve it, so that the exe can run as intended. Hope you can help me here, tried to find a solution for hours now...

推荐答案

我也遇到了同样的问题,我通过实现以下方法解决了:-

I had also encountered the same problem and i solved it by implementing the follows:-

  1. 使用 github 中可用的最新安装程序重新安装 pyinstaller 模块,即 pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
  2. 通过运行命令重新创建可执行包,即 pyinstaller --hidden-import=selenium --hidden-import=autoit your [python_file.py]
  3. 从我的 PC 目录 (C:Users\AppDataLocalProgramsPythonPython37Libsite-packages) 复制已安装的模块,即 autoit 的文件夹,并将其粘贴到 dist 文件夹中的 [python_file] 文件夹中由 pyinstaller 生成.

为了测试解决方案,我在命令提示符下重新运行生成的 .exe 文件.希望这会有所帮助.

To test the solution, i re-run the generated .exe file in command prompt. Hope this help.

这篇关于Pyinstaller:OSError:无法从路径加载 AutoItX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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