LmeSzinc / AzurLaneAutoScript

Azur Lane bot (CN/EN/JP/TW) 碧蓝航线脚本 | 无缝委托科研,全自动大世界
https://alas.azurlane.cloud
GNU General Public License v3.0
6.66k stars 785 forks source link

ImportError: DLL load failed: 找不到指定的模块。 import cv2 #1142

Closed JuuiceP closed 1 year ago

JuuiceP commented 2 years ago

在提问之前...

描述你的问题

如题,点击启动后提示找不到指定的模块 系统:win server 2012 系统python3.8.6

如何复现

No response

预期行为

No response

相关 Logs

═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
                                                         START                                                         
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
2022-05-24 13:49:31.574 | INFO | Start scheduler loop: alas                                                            
2022-05-24 13:49:31.578 | INFO | [Server] cn                                                                           
2022-05-24 13:49:31.592 | INFO | Bind task {'Alas', 'General'}                                                         
2022-05-24 13:49:31.597 | INFO | Pending tasks: ['Research', 'Commission', 'Tactical', 'Dorm', 'Meowfficer', 'Guild',  
'SupplyPack', 'Reward', 'MetaReward', 'BattlePass', 'DataKey', 'OpsiAshAssist']                                        
2022-05-24 13:49:31.601 | INFO | [Task] Research (Enable, 2020-01-01 00:00:00)                                         
2022-05-24 13:49:31.604 | INFO | Bind task {'Alas', 'General', 'Research'}                                             
2022-05-24 13:49:31.697 | ERROR | ImportError: DLL load failed: 找不到指定的模块。                                     
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\module\webui\process_manager.py:130 in run_process                │
│                                                                                                                     │
│   127 │   │   │   │                                                                                                 │
│   128 │   │   │   │   if e is not None:                                                                             │
│   129 │   │   │   │   │   AzurLaneAutoScript.stop_event = e                                                         │
│ > 130 │   │   │   │   AzurLaneAutoScript(config_name=config_name).loop()                                            │
│   131 │   │   │   elif func == "Daemon":                                                                            │
│   132 │   │   │   │   from module.daemon.daemon import AzurLaneDaemon                                               │
│   133                                                                                                               │
│                                                                                                                     │
│ ┌──────────────────────────────────── locals ────────────────────────────────────┐                                  │
│ │ AzurLaneAutoScript = <class 'alas.AzurLaneAutoScript'>                         │                                  │
│ │     AzurLaneConfig = <class 'module.config.config.AzurLaneConfig'>             │                                  │
│ │        config_name = 'alas'                                                    │                                  │
│ │                  e = ImportError('DLL load failed: 找不到指定的模块。')        │                                  │
│ │               func = 'Alas'                                                    │                                  │
│ │                  q = <AutoProxy[Queue] object, typeid 'Queue' at 0xbefebb2588> │                                  │
│ └────────────────────────────────────────────────────────────────────────────────┘                                  │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\alas.py:397 in loop                                               │
│                                                                                                                     │
│   394 │   │   │   │   │   logger.info("Update event detected")                                                      │
│   395 │   │   │   │   │   logger.info(f"Alas [{self.config_name}] exited.")                                         │
│   396 │   │   │   │   │   break                                                                                     │
│ > 397 │   │   │   task = self.get_next_task()                                                                       │
│   398 │   │   │                                                                                                     │
│   399 │   │   │   # Skip first restart                                                                              │
│   400 │   │   │   if is_first and task == 'Restart':                                                                │
│                                                                                                                     │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐                                         │
│ │ failure_record = {}                                                     │                                         │
│ │       is_first = True                                                   │                                         │
│ │           self = <alas.AzurLaneAutoScript object at 0x000000BEFEB1FB08> │                                         │
│ └─────────────────────────────────────────────────────────────────────────┘                                         │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\alas.py:357 in get_next_task                                      │
│                                                                                                                     │
│   354 │   │                                                                                                         │
│   355 │   │   from module.base.resource import release_resources                                                    │
│   356 │   │   if self.config.task.command != 'Alas':                                                                │
│ > 357 │   │   │   release_resources(next_task=task.command)                                                         │
│   358 │   │                                                                                                         │
│   359 │   │   if task.next_run > datetime.now():                                                                    │
│   360 │   │   │   logger.info(f'Wait until {task.next_run} for task `{task.command}`')                              │
│                                                                                                                     │
│ ┌────────────────────────────────── locals ──────────────────────────────────┐                                      │
│ │ release_resources = <function release_resources at 0x000000BEFF44C828>     │                                      │
│ │              self = <alas.AzurLaneAutoScript object at 0x000000BEFEB1FB08> │                                      │
│ │              task = Research (Enable, 2020-01-01 00:00:00)                 │                                      │
│ └────────────────────────────────────────────────────────────────────────────┘                                      │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\module\base\resource.py:102 in release_resources                  │
│                                                                                                                     │
│    99 │   # Release all OCR models                                                                                  │
│   100 │   # Usually to have 2 models loaded and each model takes about 20MB                                         │
│   101 │   # This will release 20-40MB                                                                               │
│ > 102 │   from module.ocr.ocr import OCR_MODEL                                                                      │
│   103 │   if 'Opsi' in next_task or 'commission' in next_task:                                                      │
│   104 │   │   # OCR models will be used soon, don't release                                                         │
│   105 │   │   models = []                                                                                           │
│                                                                                                                     │
│ ┌──────── locals ────────┐                                                                                          │
│ │ next_task = 'Research' │                                                                                          │
│ └────────────────────────┘                                                                                          │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\module\ocr\ocr.py:6 in <module>                                   │
│                                                                                                                     │
│     3 from datetime import timedelta                                                                                │
│     4 from typing import TYPE_CHECKING                                                                              │
│     5                                                                                                               │
│ >   6 from module.base.button import Button                                                                         │
│     7 from module.base.utils import *                                                                               │
│     8 from module.logger import logger                                                                              │
│     9 from module.ocr.rpc import ModelProxyFactory, deploy_config                                                   │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │  __builtins__ = {                                                                                               │ │
│ │                 │   '__name__': 'builtins',                                                                     │ │
│ │                 │   '__doc__': 'Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the   │ │
│ │                 `nil'+46,                                                                                       │ │
│ │                 │   '__package__': '',                                                                          │ │
│ │                 │   '__loader__': <class '_frozen_importlib.BuiltinImporter'>,                                  │ │
│ │                 │   '__spec__': ModuleSpec(name='builtins', loader=<class                                       │ │
│ │                 '_frozen_importlib.BuiltinImporter'>),                                                          │ │
│ │                 │   '__build_class__': <built-in function __build_class__>,                                     │ │
│ │                 │   '__import__': <built-in function __import__>,                                               │ │
│ │                 │   'abs': <built-in function abs>,                                                             │ │
│ │                 │   'all': <built-in function all>,                                                             │ │
│ │                 │   'any': <built-in function any>,                                                             │ │
│ │                 │   ... +143                                                                                    │ │
│ │                 }                                                                                               │ │
│ │    __cached__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\ocr\\__pycache__\\ocr.cpy'+11   │ │
│ │       __doc__ = None                                                                                            │ │
│ │      __file__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\ocr\\ocr.py'                    │ │
│ │    __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x000000BEFF476448>                      │ │
│ │      __name__ = 'module.ocr.ocr'                                                                                │ │
│ │   __package__ = 'module.ocr'                                                                                    │ │
│ │      __spec__ = ModuleSpec(name='module.ocr.ocr', loader=<_frozen_importlib_external.SourceFileLoader object at │ │
│ │                 0x000000BEFF476448>,                                                                            │ │
│ │                 origin='C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\ocr\\ocr.py')            │ │
│ │            re = <module 're' from 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\re.py'> │ │
│ │          time = <module 'time' (built-in)>                                                                      │ │
│ │     timedelta = <class 'datetime.timedelta'>                                                                    │ │
│ │ TYPE_CHECKING = False                                                                                           │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\module\base\button.py:9 in <module>                               │
│                                                                                                                     │
│     6                                                                                                               │
│     7 from module.base.decorator import cached_property                                                             │
│     8 from module.base.resource import Resource                                                                     │
│ >   9 from module.base.utils import *                                                                               │
│    10                                                                                                               │
│    11                                                                                                               │
│    12 class Button(Resource):                                                                                       │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │    __builtins__ = {                                                                                             │ │
│ │                   │   '__name__': 'builtins',                                                                   │ │
│ │                   │   '__doc__': 'Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the │ │
│ │                   `nil'+46,                                                                                     │ │
│ │                   │   '__package__': '',                                                                        │ │
│ │                   │   '__loader__': <class '_frozen_importlib.BuiltinImporter'>,                                │ │
│ │                   │   '__spec__': ModuleSpec(name='builtins', loader=<class                                     │ │
│ │                   '_frozen_importlib.BuiltinImporter'>),                                                        │ │
│ │                   │   '__build_class__': <built-in function __build_class__>,                                   │ │
│ │                   │   '__import__': <built-in function __import__>,                                             │ │
│ │                   │   'abs': <built-in function abs>,                                                           │ │
│ │                   │   'all': <built-in function all>,                                                           │ │
│ │                   │   'any': <built-in function any>,                                                           │ │
│ │                   │   ... +143                                                                                  │ │
│ │                   }                                                                                             │ │
│ │      __cached__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\__pycache__\\button'+15 │ │
│ │         __doc__ = None                                                                                          │ │
│ │        __file__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\button.py'              │ │
│ │      __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x000000BEFF484588>                    │ │
│ │        __name__ = 'module.base.button'                                                                          │ │
│ │     __package__ = 'module.base'                                                                                 │ │
│ │        __spec__ = ModuleSpec(name='module.base.button', loader=<_frozen_importlib_external.SourceFileLoader     │ │
│ │                   object at 0x000000BEFF484588>,                                                                │ │
│ │                   origin='C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\button.py')      │ │
│ │ cached_property = <class 'module.base.decorator.cached_property'>                                               │ │
│ │       ImageDraw = <module 'PIL.ImageDraw' from                                                                  │ │
│ │                   'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\PIL\\Im… │ │
│ │         imageio = <module 'imageio' from                                                                        │ │
│ │                   'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\imageio… │ │
│ │              os = <module 'os' from                                                                             │ │
│ │                   'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\os.py'>                 │ │
│ │        Resource = <class 'module.base.resource.Resource'>                                                       │ │
│ │       traceback = <module 'traceback' from                                                                      │ │
│ │                   'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\traceback.py'>          │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\module\base\utils.py:1 in <module>                                │
│                                                                                                                     │
│ >   1 import cv2                                                                                                    │
│     2 import numpy as np                                                                                            │
│     3 from PIL import Image                                                                                         │
│     4                                                                                                               │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │ __builtins__ = {                                                                                                │ │
│ │                │   '__name__': 'builtins',                                                                      │ │
│ │                │   '__doc__': 'Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the    │ │
│ │                `nil'+46,                                                                                        │ │
│ │                │   '__package__': '',                                                                           │ │
│ │                │   '__loader__': <class '_frozen_importlib.BuiltinImporter'>,                                   │ │
│ │                │   '__spec__': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), │ │
│ │                │   '__build_class__': <built-in function __build_class__>,                                      │ │
│ │                │   '__import__': <built-in function __import__>,                                                │ │
│ │                │   'abs': <built-in function abs>,                                                              │ │
│ │                │   'all': <built-in function all>,                                                              │ │
│ │                │   'any': <built-in function any>,                                                              │ │
│ │                │   ... +143                                                                                     │ │
│ │                }                                                                                                │ │
│ │   __cached__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\__pycache__\\utils.'+14    │ │
│ │      __doc__ = None                                                                                             │ │
│ │     __file__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\utils.py'                  │ │
│ │   __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x000000BEFFBA92C8>                       │ │
│ │     __name__ = 'module.base.utils'                                                                              │ │
│ │  __package__ = 'module.base'                                                                                    │ │
│ │     __spec__ = ModuleSpec(name='module.base.utils', loader=<_frozen_importlib_external.SourceFileLoader object  │ │
│ │                at 0x000000BEFFBA92C8>,                                                                          │ │
│ │                origin='C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\module\\base\\utils.py')          │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                                     │
│ C:\Users\Administrator\Desktop\AzurLaneAutoScript\toolkit\lib\site-packages\cv2\__init__.py:5 in <module>           │
│                                                                                                                     │
│    2 import os                                                                                                      │
│    3 import sys                                                                                                     │
│    4                                                                                                                │
│ >  5 from .cv2 import *                                                                                             │
│    6 from .data import *                                                                                            │
│    7                                                                                                                │
│    8 # wildcard import above does not import "private" variables like __version__                                   │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │ __builtins__ = {                                                                                                │ │
│ │                │   '__name__': 'builtins',                                                                      │ │
│ │                │   '__doc__': 'Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the    │ │
│ │                `nil'+46,                                                                                        │ │
│ │                │   '__package__': '',                                                                           │ │
│ │                │   '__loader__': <class '_frozen_importlib.BuiltinImporter'>,                                   │ │
│ │                │   '__spec__': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), │ │
│ │                │   '__build_class__': <built-in function __build_class__>,                                      │ │
│ │                │   '__import__': <built-in function __import__>,                                                │ │
│ │                │   'abs': <built-in function abs>,                                                              │ │
│ │                │   'all': <built-in function all>,                                                              │ │
│ │                │   'any': <built-in function any>,                                                              │ │
│ │                │   ... +143                                                                                     │ │
│ │                }                                                                                                │ │
│ │   __cached__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\cv2\\'+35   │ │
│ │      __doc__ = None                                                                                             │ │
│ │     __file__ = 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\cv2\\'+11   │ │
│ │   __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x000000BEFFBCB308>                       │ │
│ │     __name__ = 'cv2'                                                                                            │ │
│ │  __package__ = 'cv2'                                                                                            │ │
│ │     __path__ = ['C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\cv2']      │ │
│ │     __spec__ = ModuleSpec(name='cv2', loader=<_frozen_importlib_external.SourceFileLoader object at             │ │
│ │                0x000000BEFFBCB308>,                                                                             │ │
│ │                origin='C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\site-packages\\cv2… │ │
│ │                submodule_search_locations=['C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\li… │ │
│ │    importlib = <module 'importlib' from                                                                         │ │
│ │                'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\importlib\\__init__.py'>   │ │
│ │           os = <module 'os' from 'C:\\Users\\Administrator\\Desktop\\AzurLaneAutoScript\\toolkit\\lib\\os.py'>  │ │
│ │          sys = <module 'sys' (built-in)>                                                                        │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
ImportError: DLL load failed: 找不到指定的模块。

截图

QQ截图20220524135225

还有别的吗?

No response

LmeSzinc commented 2 years ago
  1. Alas 指定 python==3.7.6,不要用更高版本的 python,建议新建虚拟环境安装 Alas
  2. 检查你是否安装有其他 opencv,下面的 opencv 中只能同时安装一个,Alas 使用的是 opencv-python
    opencv-python
    opencv-contrib-python
    opencv-python-headless
    opencv-contrib-python-headless
Mozooo commented 2 years ago

看你这个系统,你这个是云服务器吧,我刚开始也被这个困扰到了,后来在网上看到有个办法就是要添加一个文件,具体步骤是: 1、在开始菜单栏里打开服务器管理器 2、选择添加角色和功能 3、一直点下一步,直到【功能】这一步 4、在【功能】界面往下拉,找到【用户界面和基础结构】 5、勾上【桌面体验】 6、一直点下一步,直到安装完毕,重启云服务 7、完毕

LmeSzinc commented 2 years ago

基本确定opencv导入不了,都是在windows服务器上安装alas的,一般服务器上没有图形界面,也没有显卡,所以需要安装的是 opencv-python-headless,并且不能安装有 opencv-python

yangwangkong commented 1 year ago

看你这个系统,你这个是云服务器吧,我刚开始也被这个困扰到了,后来在网上看到有个办法就是要添加一个文件,具体步骤是: 1、在开始菜单栏里打开服务器管理器 2、选择添加角色和功能 3、一直点下一步,直到【功能】这一步 4、在【功能】界面往下拉,找到【用户界面和基础结构】 5、勾上【桌面体验】 6、一直点下一步,直到安装完毕,重启云服务 7、完毕

感谢大佬解惑