Unity关于MlAgent的安装中出现的问题与解决方案分享
unity的MLAgent其实已经推出有段时间了,但是奇怪的是在安装的时候明明按照教程一步步来的还是会出现很多教程上没有的问题。
1.第一个问题就是python的版本问题导致后面进行训练是无法连接,我的版本是3.10.x的教程上说3.6.x以上的版本都行,其实不行,3.9.x以上的都不兼容,所以我们需要下载python3.8.x的版本然后在创建虚拟环境时指定用python3.8.x版本的创建,这样就可以解决numpy中的wheel问题。
问题描述:TypeError: CCompiler_spawn() got an unexpected keyword argument 'env' [end of output] note:
This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for numpy
Failed to build numpy ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
创建命令行如下:
py -3.8 -m venv 你的虚拟环境的名字
你的虚拟环境的名字/Scripts/activate
python install torch
python install mlagents
在创建好了后还需要将protobuf包的版本降低以兼容python版本,降低到3.20.x即可。
最后还要install一个packaging包,然后就可以运行官方给的模板训练了。
mlagents-learn --help
成功运行help命令行后的界面:

下面还有,其实就是具体的帮助界面,只要有这个其实就成功了。
成功运行训练后的界面:
