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

Apple silicon Monterey设备上Austin命令行剖析Python程序失败求助

解决Apple Silicon Monterey上Austin无法识别Python进程的问题

操作与报错回顾

  • 初始执行VSCode生成的命令:

    austin -i 100 --pipe /usr/bin/python3 /Users/mh/p131.py
    

    报错:

    👾 It looks like you are trying to profile a process that is not a Python process. Make sure that you are targeting the right application. If the Python process is actually a child of the target process then use the -C option to discover it automatically.

  • 添加-C选项后执行:

    austin -i 100 -C --pipe /usr/bin/python3 /Users/mh/p131.py
    

    报错:

    👽 Not a Python process.

    🚼 It looks like you are trying to profile a process that is not a Python process, and that has not spawned any child Python processes. Make sure that you are targeting the right application.


具体解决方案

1. 匹配Python与Austin的架构

Apple Silicon上Python分ARM64原生和x86_64(Rosetta转译)两种架构,需确保和Austin版本一致:

  • 检查当前Python架构:
    /usr/bin/python3 -c "import platform; print(platform.machine())"
    
    若输出arm64,确认Austin是ARM64编译版;若为x86_64,则需用x86版本Austin或通过Rosetta运行Austin。

2. 使用原生ARM64 Python路径

系统默认的/usr/bin/python3可能走Rosetta转译,试试Homebrew安装的原生ARM64 Python:

austin -i 100 --pipe /opt/homebrew/bin/python3 /Users/mh/p131.py

未安装Homebrew的话先执行:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python

3. 授予Austin系统权限

Monterey的隐私限制可能阻止Austin访问进程:

  1. 打开「系统设置」→「隐私与安全性」→「完全磁盘访问权限」
  2. 点击加号,添加Austin可执行文件(通常在/usr/local/bin/austin或/opt/homebrew/bin/austin)
  3. 重启终端后重试命令

4. 移除--pipe选项尝试

--pipe在Apple Silicon上可能存在兼容性问题,直接运行:

austin -i 100 /usr/bin/python3 /Users/mh/p131.py

需要保存数据的话用重定向:

austin -i 100 /usr/bin/python3 /Users/mh/p131.py > profile_data.txt

5. 更新Austin到最新版

确保使用最新版本修复架构兼容问题:

brew upgrade austin  # Homebrew安装的情况

或从官方渠道重新下载对应ARM64的二进制文件替换现有安装。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 17:27:21