'UnityEnvironment' 对象没有属性 'get_agent_groups' ( mlagents_envs 0.16.1 )

'UnityEnvironment' object has no attribute 'get_agent_groups' ( mlagents_envs 0.16.1 )

python 版本为

Python 3.6.10 :: Anaconda, Inc.

并且能够成功地关注 this 文档
但是后来我想用 PYTHON-API 控制环境所以我跟着 this 和我的代码

from mlagents_envs.environment import UnityEnvironment
import mlagents_envs
env = UnityEnvironment(file_name="v1-ball-cube-game.x86_64", 
                       base_port=5004, 
                       seed=1, 
                       side_channels=[])
# env = UnityEnvironment(file_name=None, base_port=5004, seed=1,worker_id=0, side_channels=[])

print(mlagents_envs.__version__)  # outputs 0.16.1
print(env.reset()) # outputs None
print(env) # outputs <mlagents_envs.environment.UnityEnvironment object at 0x7f3ed001c278>
print(str(env.get_agent_groups())) # outputs error

以上代码输出

0.16.1
None
<mlagents_envs.environment.UnityEnvironment object at 0x7f3ed001c278>
Traceback (most recent call last):
  File "index.py", line 12, in <module>
    print(str(env.get_agent_groups()))
AttributeError: 'UnityEnvironment' object has no attribute 'get_agent_groups'

我有这段代码,为什么函数 get_agent_groups 没有定义?我无法找到解决方案。另外它是用文档写的

就像'derHugo'已经提到的,它基本上是重复的。

您指向的是版本 0.15 的文档,但使用的是版本 0.16.1

env.get_agent_groups() 被替换为 env.get_behavior_names()

This 是与你的版本匹配的文档