如何在ubuntu调用exe文件
目录
前言:
一# 安装wine
二#使用wine + exe文件
1.在bash中使用
2.在python中使用
前言:
最近我发现我使用魔法在windows上老是网络不稳定,今天突然惊醒,我记得我在ubuntu使用了很久都没有问题阿,所以想要在擎郎机器人的网关电脑上直接装ubuntu,果然如此,网络稳定了很多。但是我的擎朗机器人上有一个点击器是exe文件,这就是我为沙使用windows的原因。但是我系统装好了才猛然发掘,所以现在需要在ubuntu中使用exe文件。
一# 安装wine
sudo apt update
sudo apt install wine
验证安装是否成功
wine --version # 输出类似 wine-8.0 即成功
二#使用wine + exe文件
1.在bash中使用
在前面加上了wine。
wine ctrl.exe ESP_DED9B3 123 '[{"jx":1, "type":"单击", "delayTime":1}]'

2.在python中使用
import subprocess
import json
import timeif __name__ == '__main__':cmds = [{'jx': 1, 'type': '单击', 'delayTime': 1},{'jx': 1, 'type': '双击', 'delayTime': 1},{'jx': 1, 'type': '长按', 'delayTime': 1}]cmds_json = json.dumps(cmds, ensure_ascii=False, indent=4)while True:# 关键:用 wine 调用 exe,注意替换 ctrl.exe 的实际路径(绝对路径更可靠)# 格式:subprocess.call(['wine', 'exe的绝对路径', '参数1', '参数2', ...])subprocess.call(['wine', 'application\qinglang\ctrl.exe', # 替换为 ctrl.exe 在 Ubuntu 中的实际路径(例如 ~/Downloads/ctrl.exe)'ESP_DED9B3', '123', cmds_json])time.sleep(5)

