You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下语音助理调用Chrome打开Google Maps报错系统找不到指定路径如何解决

错误修复指南

报错根源

当前代码同时混用了 macOS 和 Windows 两套系统的命令规则,因此触发路径不存在报错:

  • /usr/bin/open 是 macOS 专属的应用启动命令,Windows 系统无此路径
  • 代码中写的 Chrome 路径后缀 .app 是 macOS 应用的专属后缀,Windows 平台 Chrome 可执行文件后缀为 .exe,不存在 .app 格式的程序文件

修复步骤

1. 替换启动命令与Chrome路径

Windows 平台启动指定程序打开链接使用 start 命令,Chrome 默认安装路径为 C:/Program Files/Google/Chrome/Application/chrome.exe,注意路径和目标URL之间需要保留空格。

2. 替换对应代码段

修正后的完整代码如下:

if "where is" in data:
    listening = True
    data = data.split(" ")
    location_url = "https://www.google.com/maps/place/" + str(data[2])
    respond("Hold on Sienan, I will show you where " + data[2] + " is.")
    # Windows平台启动Chrome打开谷歌地图的命令
    maps_arg = 'start "" "C:/Program Files/Google/Chrome/Application/chrome.exe" ' + location_url
    os.system(maps_arg)

可选优化方案

如果不需要强制指定Chrome打开链接,可以直接调用系统默认浏览器打开,无需写死应用路径,兼容性更强:

# 提前导入webbrowser模块
import webbrowser

if "where is" in data:
    listening = True
    data = data.split(" ")
    location_url = "https://www.google.com/maps/place/" + str(data[2])
    respond("Hold on Sienan, I will show you where " + data[2] + " is.")
    webbrowser.open(location_url)

如果Chrome安装在非默认路径,自行找到chrome.exe的实际存放路径,替换上述代码中的Chrome路径即可正常运行。

内容的提问来源于stack exchange,提问作者Bob

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 11:15:04