问题遇到的现象和发生背景
python调用易键鼠.dll,会报错,看看呢,另一台电脑可以正常使用不报错
问题相关代码,请勿粘贴截图
import random
import time
import pyautogui as pyautogui
from FPSDetect import *
from ctypes import *
# 加载相关工具函数
from utils.FPSUtils import *
dll = cdll.LoadLibrary(r'lib/Dll.dll') # 加载用C语言封装过的“易键鼠”dll
def shoot_screen():
while True:
img = pyautogui.screenshot(region=[LEFT, TOP, 640, 640]) # region为屏幕截取区域格式为(left,top,w,h)
# 存储游戏过程中的截图的路径
images_path = 'E:/data/CSGO/images/'
img.save(
images_path + str(int(time.time())) + ''.join(
random.sample('zyxwvutsrqponmlkjihgfedcba', 2)) + '.jpg') # 随机生成文件名
time.sleep(0.5)
if __name__ == "__main__":
# ssp = Process(target=shoot_screen, name="ssp", args=())
# ssp.start()
# mPid = PID(0, 0, 1.0, 0) # PID 控制器参数:(真值,p,i,d)(有问题)
while True:
try:
img = ScreenShout() # 截取屏幕检测区域
detections = detect(img) # 送入yolo检测
btc, btp = FindBestCenter(detections) # 确定目标最优的射击中心
if btc is not None: # 如果屏幕区域有射击目标
dll.MoveTo2(int(LEFT + btc[0]), int(TOP + btc[1])) # 调用易键鼠移动鼠标(此处更换为自己的)
# pyautogui.moveTo(int(LEFT + btc[0]), int(TOP + btc[1]))
except:
print('ERROR!')
运行结果及报错内容
Traceback (most recent call last):
File "D:\python\FPSAutomaticAiming-main\Main.py", line 12, in <module>
dll = cdll.LoadLibrary(r'lib/Dll.dll') # 加载用C语言封装过的“易键鼠”dll
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'D:\python\FPSAutomaticAiming-main\lib\Dll.dll' (or one of its dependencies). Try using the full path with constructor syntax.
我的解答思路和尝试过的方法
暂无