为什么我在尝试安装gym[all]时遇到错误?

问题描述 投票:0回答:1

我正在尝试安装

gym[all]
,但每次都会收到此错误消息:

Collecting pygame==2.1.0 (from gym[all])
  Using cached pygame-2.1.0.tar.gz (5.8 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [77 lines of output]
      
      
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using WINDOWS configuration...

所有输出之后,消息是这样的:

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

如果我尝试在 Google Colab 上安装

box2d-py
,这是我收到的错误:

Building wheels for collected packages: box2d-py
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for box2d-py (setup.py) ... error
  ERROR: Failed building wheel for box2d-py
  Running setup.py clean for box2d-py
Failed to build box2d-py
ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects

有人知道这是怎么回事吗?

谢谢!

我已经安装了 Visual Studio 构建工具。我尝试在 Google Colab 上安装时遇到类似的错误。我的Python版本是

Python 3.11.3

python pytorch google-colaboratory reinforcement-learning openai-gym
1个回答
0
投票

您的问题可能是您使用的是 Python 3.11 或更高版本。不支持 pygame 2.1.0 包。您可以下载 Python 3.10,这应该可以解决问题

© www.soinside.com 2019 - 2024. All rights reserved.