Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么在Linux服务器上运行demo程序? #124

Open
bjzhb666 opened this issue Jan 27, 2023 · 2 comments
Open

怎么在Linux服务器上运行demo程序? #124

bjzhb666 opened this issue Jan 27, 2023 · 2 comments

Comments

@bjzhb666
Copy link

bjzhb666 commented Jan 27, 2023

# 导入gym环境
import gym
# 声明所使用的环境
env = gym.make('CartPole-v0',render_mode="rgb_array")
# 环境初始化
env.reset()
 
# 对环境进行迭代执行1000次
for _ in range(1000):
    env.render()
    observation, reward, done, info,_ = env.step(env.action_space.sample()) # 采取随机动作
    if done:
       env.reset()
env.close()

在Linux server下运行,但是没有图形界面出现,没有出现倒立摆,程序也没有报错,怎样能出现图像界面呢?
我使用的是Xming将远程界面发送回来,比如运行xclock是可以发送回来时钟的界面的,除此以外还需要配置什么吗?

@misaka0502
Copy link

你好,请问这个问题解决了吗,我最近在尝试使用VcXsrv,也是能传回来xclock的画面,但是运行gym的画面传不回来

@misaka0502
Copy link

你好,请问这个问题解决了吗,我最近在尝试使用VcXsrv,也是能传回来xclock的画面,但是运行gym的画面传不回来

已解决,需要根据gym的版本在gym.make或者render里面传入参数render_mode/mode(具体要看gym的版本和文档),才会显示画面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants