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

使用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 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配