hruffhfn1 2020-03-08 00:09 采纳率: 0%
浏览 929

使用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条回答

  • dabocaiqq 2020-03-08 10:44
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置