简体   繁体   中英

Pyinstaller OSError: Cannot load AutoItX

I used import autoit . The script is running perfectly from VSCode and from Control Panel. But when making it an executable with PyInstaller, when I run the.exe file I get this error message:

在此处输入图像描述

pyinstaller --hidden-import=autoit --onefile run.py didn't work. How to bypass this problem?

1)Copy file( AutoItX3_x64.dll ) from address

C:\Users\alire\AppData\Local\Programs\Python\Python39\Lib\site-packages\autoit\lib\
  1. Build folder( autoit\lib ) in project and copy file there

After some time of searching i find a solution about my problem.

The solution i found working was by using the cmd .

1) I use this command to define the PATH of the file:

cd C:\Users\bilakos\Desktop\PYTHON_PROJECTS\BOT

2) Then i use this command to create the working executable .exe file:

pyinstaller --onefile --add-data C:\Users\bilakos\AppData\Local\Programs\Python\Python39\Lib\site-packages\autoit\lib\AutoItX3_x64.dll;autoit\lib Bot.py

For me that worked. I hope if somebody experienced the same issue, to get help be reading my solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM