多智能体环境安装

对于python 游戏页面不能显示问题,如多智能体,或者gym游戏

我是安装openai发布的多智能体框架

https://github.com/openai/multiagent-particle-envs
https://github.com/openai/maddpg

修改了两个地方:
tf_util.py (maddpg-master里)
def softmax(x, axis=None):
return tf.nn.softmax(x, dim=axis)

以及多智能体那的环境,多输入了dtype

然后如果不显示界面,可以运行了,但是显示界面就报错,

Traceback (most recent call last):
  File "/home/tsou/Documents/yww/grade2_up/maddpg-master/experiments/train.py", line 11, in 
    from pyglet.window import key
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1816, in 
    gl._create_shadow_window()
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 163, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/window/__init__.py", line 504, in __init__
    config = screen.get_best_config(template_config)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/canvas/base.py", line 161, in get_best_config
    configs = self.get_matching_configs(template)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/canvas/xlib.py", line 179, in get_matching_configs
    configs = template.match(canvas)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 29, in match
    have_13 = info.have_version(1, 3)
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/gl/glx_info.py", line 86, in have_version
    client_version = self.get_client_version().split()[0]
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/gl/glx_info.py", line 118, in get_client_version
    return asstr(glXGetClientString(self.display, GLX_VERSION))
  File "/home/tsou/anaconda3/lib/python3.6/site-packages/pyglet/compat.py", line 88, in asstr
    return s.decode("utf-8")
AttributeError: 'NoneType' object has no attribute 'decode'

然后看了下,总是from pyglet.window import key这句错,于是把它放在主函数,结果瞎猫碰到死耗子,解决了。然后进一步的,发现:
并且还跟放的位置有关,把它放在import tensorflow.contrib.layers as layers后面就错,这样,render错误就解决了。

其实这个问题困扰了快7,8 个月了,以前没有render()也无所谓,现在多智能体还是需要的界面的。试过很多方法,都不行,结果放在主函数就行,,,这真是的。

你可能感兴趣的:(Python,强化学习)