题意:怎样在Windows上安装OpenAI Universe并避免出现错误代码1
问题背景:
When I try to install OpenAi Universe on my Windows machine via python pip I get following stacktrace:
当我尝试通过 `python pip` 在我的 Windows 机器上安装 OpenAI Universe 时,我得到了以下堆栈跟踪:
Traceback (most recent call last):File "<string>", line 1, in <module>File "C:\Users\Me\AppData\Local\Temp\pip-build-yjf_mrwx\fastzbarlight\setup.py", line 49, in <module>proc = subprocess.Popen(['ld', '-liconv'], stderr=subprocess.PIPE)File "E:\Python3.5.2\lib\subprocess.py", line 947, in __init__restore_signals, start_new_session)File "E:\Python3.5.2\lib\subprocess.py", line 1224, in _execute_childstartupinfo)FileNotFoundError: [WinError 2] The system cannot find the file specified
And this error code: 错误信息如下:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Me\AppData\Local\Temp\pip-build-yjf_mrwx\fastzbarlight\
I tried everything mentioned here. I also read through the documentation and found this:
我尝试了这里提到的所有方法。我也阅读了文档,并发现了以下内容:
"While we don’t officially support Windows, we expect our code to be very close to working there. We’d be happy to take pull requests that take our Windows compatibility to 100%."
So I guess it might just not work, but I think that it should work.
所以我猜它可能就是无法正常运行,但我认为它应该可以运行。
问题解决:
Currently, Universe is not officially supported on Windows machines. You can, however, use the Linux subsystem for Windows to install both Gym and Universe with no real issues. Basically, all you need to do is to follow these instructions that were adapted from this comment by MaxOSmith from Gym on GitHub (I was able to use them to install Universe as well):
目前,Universe 尚未正式支持在 Windows 机器上运行。不过,你可以使用 Windows 的 Linux 子系统来安装 Gym 和 Universe,基本上没有什么问题。基本上,你只需要按照这些说明操作,这些说明是基于 GitHub 上 MaxOSmith 在 Gym 项目中的评论修改的(我也通过这些说明成功安装了 Universe):
-
Update to the latest version of Windows (>version 1607, "Anniversary Update").
将 Windows 更新到最新版本(大于 1607 版本,“周年更新”)
-
Enable Windows Subsystem for Linux (WSL).
启用 Windows 的 Linux 子系统(WSL)。
-
Open cmd, run bash. 打开命令提示符,运行
bash
。 -
Install Python, Gym and Universe (using sudo, and NOT PIP). Also make sure to look at the system requirements and follow the typical Universe Linux install, aka get golang etc.
安装 Python、Gym 和 Universe(使用 sudo
,而不是 pip
)。还要确保查看系统要求,并按照常规的 Universe Linux 安装步骤进行操作,例如获取 golang 等
-
Install vcXsrv, and run it (you should just have a little tray icon). We install this because WSL is not supported and it can cause some crazy graphical errors to occur.
安装 vcXsrv 并运行它(你应该会看到一个小的托盘图标)。我们安装这个是因为 WSL 不支持图形界面,这可能会导致一些奇怪的图形错误发生
-
In bash, run 运行以下命令
export DISPLAY=:0
Now, when you run it you should get a display to pop-up, there may be issues related to graphics drivers. Sadly, this is where the instructions diverge if you don't have an NVIDIA graphics card.
现在,当你运行它时,你应该会看到一个显示界面弹出,可能会出现与图形驱动程序相关的问题。遗憾的是,如果你没有 NVIDIA 显卡,这里可能会出现不同的操作步骤
-
Get the drivers: 获得驱动
sudo apt-get install nvidia-319 nvidia-settings-319 nvidia-prime
-
Play with it. 运行
As an aside, I plan to start contributing to Universe and the first thing I want to do is make it work naively on Windows.
顺便说一下,我计划开始为 Universe 做贡献,首先我想做的就是让它可以直接在 Windows 上运行。