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

VSCode运行PyAutoGUI报错:AttributeError: objc_msgSendSuper_stret符号未找到

问题:M1 MacBook Air在VSCode中运行PyAutoGUI报错objc_msgSendSuper_stret: symbol not found

在MacBook Air M1(2020款,Ventura 13.2系统)环境下,尝试在VSCode中运行一个仅导入PyAutoGUI并执行点击操作的简单Python程序。终端使用相同Python环境运行完全正常,但VSCode中运行时出现如下错误:

Traceback (most recent call last):
  File "/Users/***/Desktop/Solitaire/runner.py", line 1, in <module>
    import SolitaireSolver
  File "/Users/***/Desktop/Solitaire/SolitaireSolver.py", line 1, in <module>
    import time, pyautogui
  File "/opt/homebrew/lib/python3.10/site-packages/pyautogui/__init__.py", line 249, in <module>
    import mouseinfo
  File "/opt/homebrew/lib/python3.10/site-packages/mouseinfo/__init__.py", line 100, in <module>
    from rubicon.objc import ObjCClass, CGPoint
  File "/opt/homebrew/lib/python3.10/site-packages/rubicon/objc/__init__.py", line 33, in <module>
    from . import api, collections, runtime, types
  File "/opt/homebrew/lib/python3.10/site-packages/rubicon/objc/api.py", line 28, in <module>
    from .runtime import (
  File "/opt/homebrew/lib/python3.10/site-packages/rubicon/objc/runtime.py", line 460, in <module>
    libobjc.objc_msgSendSuper_stret.restype = None
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x3a212e95c, objc_msgSendSuper_stret): symbol not found

VSCode版本:1.77.3(Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710);PyAutoGUI版本0.9.53。


解决方案

1. 确保VSCode使用的Python解释器与终端一致

  • 打开VSCode,按下Cmd+Shift+P,输入Python: Select Interpreter
  • 选择终端执行which python3返回的路径(例如/opt/homebrew/bin/python3.10)

2. 修复Rubicon-objc依赖兼容性问题

该错误是rubicon-objc在ARM架构Mac上的已知兼容性问题,执行以下命令重新安装相关依赖:

# 先卸载现有依赖
pip3 uninstall -y rubicon-objc mouseinfo pyautogui
# 重新安装PyAutoGUI
pip3 install pyautogui

如果仍有问题,尝试指定安装兼容版本:

pip3 install rubicon-objc==0.4.2

3. 授予VSCode辅助功能权限

  • 打开「系统设置」→「隐私与安全性」→「辅助功能」
  • 找到VSCode并勾选权限,若未在列表中,点击+添加应用程序
  • 重启VSCode后重新运行程序

4. 切换VSCode到Rosetta模式运行

  • 在应用程序中找到VSCode,右键选择「显示简介」
  • 勾选「使用Rosetta打开」,重启VSCode
  • 重新选择Python解释器后运行程序

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 14:25:31