最近在搞 Unity+机器学习
遇到了版本冲突问题 来来回回一天之内 创建了七八九十个虚拟环境以后
终于找到了匹配的版本!!!!
++版本记录:++
Unity:2021.3.44f1c1
ML-agents:ml-agents-release_19 (下载地址:发布 ·Unity-Technologies/ml-agents)
python:3.7(下载地址:Python Releases for Windows | Python.org)
torch:1.7.0
mlagents:0.28.0
++cmd记录:++
- 定位到Unity project:
C:\Users\User>cd C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114
- 指定py3.7创建虚拟环境
C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>py -3.7 -m venv venv
- 启动虚拟环境
C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>venv\scripts\activate
- 安装pip
(venv) C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>py -m pip install --upgrade pip
- 下载torch(注意一定不要开vpn)
(venv) C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>pip install torch==1.7.0 -f https://download.pytorch.org/whl/torch_stable.html
- 安装mlagents,指定版本:0.28.0
(venv) C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>pip install mlagents==0.28.0
- 检查是否安装成功
(venv) C:\Users\User\Desktop\MEP-Clash report\Models\PathPlanning_Unity\DRL_PathPlanning20241114>mlagents-learn --help
完事大吉↓ python端的环境配完了!!!
++Unity端配置记录:++
- 下载
ML-agents:ml-agents-release_19 (下载地址:发布 ·Unity-Technologies/ml-agents)
- 仅仅将↑中的,两项放到建的Unity中
- 修改manifest.json,添加↓两项
"com.unity.ml-agents": "file:../com.unity.ml-agents",
"com.unity.ml-agents.extensions": "file:../com.unity.ml-agents.extensions"
- 打开Unity,自动导入,0报错,完事打击咔咔咔咔