macOS Sonoma(M3芯片)本地安装Drake运行机器人课程代码报错求助
解决Robotic Manipulation课程代码在M3 Mac本地运行的初始化错误
问题根源
错误栈里的AttributeError: itemset was removed from the ndarray class in NumPy 2.0是核心原因:你的环境默认安装了NumPy 2.0,但当前版本的pydrake(manipulation依赖的底层库)尚未适配NumPy 2.0的API变更;同时Python 3.12的兼容性也未被该版本的manipulation包完全支持。
解决步骤
创建兼容的Python环境
重新创建环境时指定Python 3.11(课程推荐的稳定版本,兼容性更可靠):mamba create -n robotic_manipulation python=3.11 mamba activate robotic_manipulation锁定NumPy版本并安装依赖
先安装NumPy 1.x系列版本,再安装manipulation和notebook,避免自动拉取NumPy 2.0:pip install numpy<2.0 pip install manipulation==2024.04.22 --extra-index-url https://drake-packages.csail.mit.edu/whl/nightly/ pip install notebook确保zmq依赖正常
维持之前的操作,确保meshcat所需的zmq已安装:brew install zmq重新启动Jupyter Notebook
激活环境后启动notebook,再次运行intro.ipynb的导入代码:jupyter notebook
额外提示
MIT Robotic Manipulation课程官方推荐使用Python 3.10或3.11,避免使用过新的Python版本,可大幅减少这类兼容性问题。
内容的提问来源于stack exchange,提问作者jonzamora
相关产品推荐
相关产品推荐

