使用pyinstaller成产exe可执行文件后,运行时一闪而过

代码如下:是用pycharm写的。

import win32api
import win32con
import keyboard
import time

def WithoutShift(*args):  # 不带shift建的输入
    for i in args:
        win32api.keybd_event(i, 0, 0, 0)
        win32api.keybd_event(i, 0, win32con.KEYEVENTF_KEYUP, 0)
        time.sleep(0.05)
    time.sleep(0.05)


def WithShift(*args):
    win32api.keybd_event(16, 0, 0, 0)
    for i in args:
        win32api.keybd_event(i, 0, 0, 0)
        win32api.keybd_event(i, 0, win32con.KEYEVENTF_KEYUP, 0)
        time.sleep(0.05)
    win32api.keybd_event(16, 0, win32con.KEYEVENTF_KEYUP, 0)
    time.sleep(0.05)


keyboard.wait('`')
'''GetPlayer().components.builder:GiveAllRecipes() '''
WithoutShift(65, 13, 192)

WithoutShift(20, 71, 20, 69, 84, 20, 80, 20, 76, 65, 89, 69, 82)
WithShift(57, 48)
WithoutShift(190, 67, 79, 77, 80, 79, 78, 69, 78, 84, 83, 190, 66, 85, 73, 76, 68, 69, 82)
WithShift(186, 71, 65, 82, 57, 48)
WithoutShift(37, 37, 37, 37, 73, 86, 69, 39, 76, 76, 39, 69, 67, 73, 80, 69, 83, 39, 39, 13, 192)

WithoutShift(20, 71, 20, 69, 84, 20, 80, 20, 76, 65, 89, 69, 82)
WithShift(57, 48)
WithoutShift(190, 67, 79, 77, 80, 79, 78, 69, 78, 84, 83, 190, 72, 69, 65, 76, 84, 72)
WithShift(186, 83, 77, 72, 57, 48)
WithoutShift(37, 37, 37, 37, 69, 84, 39, 65, 88, 39, 69, 65, 76, 84, 72, 39, 49, 48, 48, 48, 48, 48, 48, 39, 13, 192)

WithoutShift(20, 71, 20, 69, 84, 20, 80, 20, 76, 65, 89, 69, 82)
WithShift(57, 48)
WithoutShift(190, 67, 79, 77, 80, 79, 78, 69, 78, 84, 83, 190, 72, 85, 78, 71, 69, 82)
WithShift(186, 83, 77, 57, 48)
WithoutShift(37, 37, 37, 69, 84, 39, 65, 88, 39, 49, 48, 48, 48, 39, 13, 192)

WithoutShift(20, 71, 20, 69, 84, 20, 80, 20, 76, 65, 89, 69, 82)
WithShift(57, 48)
WithoutShift(190, 67, 79, 77, 80, 79, 78, 69, 78, 84, 83, 190, 83, 65, 78, 73, 84, 89)
WithShift(186, 83, 77, 57, 48)
WithoutShift(37, 37, 37, 69, 84, 39, 65, 88, 39, 49, 48, 48, 48, 39, 13, 192)

# minimap = TheSim:FindFirstEntityWithTag("minimap")
WithoutShift(77, 73, 78, 73, 77, 65, 80, 32, 187, 32, 20, 84, 20, 72, 69, 20, 83, 20, 73, 77)
WithShift(186, 57, 222, 222, 48)  # :("")
WithoutShift(37, 37, 37, 37, 20, 70, 20, 73, 78, 68, 20, 70, 20, 73, 82, 83, 84, 20, 69, 20, 78, 84, 73, 84, 89,
             20, 87, 20, 73, 84, 72, 20, 84, 20, 65, 71, 39, 39, 77, 73, 78, 73, 77, 65, 80, 39, 39, 13, 192)

# minimap.MiniMap:ShowArea(0,0,0, 10000)
WithoutShift(77, 73, 78, 73, 77, 65, 80, 190, 20, 77, 20, 73, 78, 73, 20, 77, 20, 65, 80)
WithShift(186, 83, 65, 57, 48)  # :("")
WithoutShift(37, 37, 37, 72, 79, 87, 39, 82, 69, 65, 39, 48, 188, 48, 188, 48, 188, 32, 49, 48, 48, 48, 48, 39, 13)

通过pyinstaller生成exe文件,执行的时候窗口一闪而过,用cmd终端执行,提示以下信息:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
ImportError: DLL load failed while importing win32api: 找不到指定的模块。
[10088] Failed to execute script test

电脑明明装了pywin库的啊,网上各种搜索也没有找到解决办法,希望有大神帮帮看看,不胜感激

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐