0

我试图安装 Mujoco 并运行一个简单的脚本:

import gym # openAi gym
from gym import envs
env_name = 'InvertedDoublePendulum-v2'
env = gym.make(env_name)
env.reset()
for _ in range(1000):
    env.render()
    env.step(env.action_space.sample()) # take a random action
env.close()

但是我遇到了以下错误:“C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 2 "

Python 版本:3.7.4 健身房版本:0.21.0

我已经下载了 microsoft visual studio build tools 2019 并重新启动了系统,但似乎没有帮助。任何帮助表示赞赏。

4

1 回答 1

0

您可能缺少 Visual Studion 构建工具(它是您需要安装的额外命令行工具集)

https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

编辑:

根据此处找到的线程,您应该设置以下内容:

INCLUDE="C:\Program Files (x86)\Windows Kits0\Include\10.0.19041.0\ucrt"
LIB="C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\um\x86;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\ucrt\x86"
set INCLUDE="C:\Program Files (x86)\Windows Kits0\Include\10.0.19041.0\ucrt"

set LIB="C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\um\x86;C:\Program Files (x86)\Windows Kits0\Lib\10.0.19041.0\ucrt\x86"
于 2021-12-29T08:51:37.650 回答