安装健身房的问题(枕头的构建轮(setup.py)...错误)

Problem with installing gym ( Building wheel for Pillow (setup.py) ... error)

我想在我的电脑上安装健身房,所以我尝试了 pip install gym

everything went fine till 
Collecting gym
  Using cached gym-0.18.0-py3-none-any.whl
Requirement already satisfied: numpy>=1.10.4 in c:\users\csc\appdata\local\programs\python\python39\lib\site-packages (from gym) (1.19.4)
Requirement already satisfied: pyglet<=1.5.0,>=1.4.0 in c:\users\csc\appdata\local\programs\python\python39\lib\site-packages (from gym) (1.5.0)
Requirement already satisfied: scipy in c:\users\csc\appdata\local\programs\python\python39\lib\site-packages (from gym) (1.5.4)
Collecting cloudpickle<1.7.0,>=1.2.0
  Using cached cloudpickle-1.6.0-py3-none-any.whl (23 kB)
Collecting Pillow<=7.2.0
  Using cached Pillow-7.2.0.tar.gz (39.1 MB)
Requirement already satisfied: future in c:\users\csc\appdata\local\programs\python\python39\lib\site-packages (from pyglet<=1.5.0,>=1.4.0->gym) (0.18.2)
Building wheels for collected packages: Pillow
  Building wheel for Pillow (setup.py) ... error

但是犯了一个大错误

ERROR: Command errored out with exit status 1:
   command: 'c:\users\csc\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py'"'"'; __file__='"'"'C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\CSC\AppData\Local\Temp\pip-wheel-rj69kfwz'
       cwd: C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\
  Complete output (172 lines):
  C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py:42: RuntimeWarning: Pillow 7.2.0 does not support Python 3.9 and does not provide prebuilt Windows binaries. We do not recommend building from source on Windows.
    warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  copying src\PIL\Image.py -> build\lib.win-amd64-3.9\PIL
  copying src\PIL\ImageChops.py -> build\lib.win-amd64-3.9\PIL
  copying src\PIL\ImageCms.py -> build\lib.win-amd64-3.9\PIL
  writing dependency_links to src\Pillow.egg-info\dependency_links.txt
  writing top-level names to src\Pillow.egg-info\top_level.txt
  reading manifest file 'src\Pillow.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.c'
  warning: no files found matching '*.h'
  warning: no files found matching '*.sh'
  warning: no previously-included files found matching '.appveyor.yml'
  warning: no previously-included files found matching '.coveragerc'
  warning: no previously-included files found matching '.editorconfig'
  warning: no previously-included files found matching '.readthedocs.yml'
  warning: no previously-included files found matching 'codecov.yml'
  warning: no previously-included files matching '.git*' found anywhere in distribution
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.so' found anywhere in distribution
  no previously-included directories found matching '.ci'
  writing manifest file 'src\Pillow.egg-info\SOURCES.txt'
  running build_ext


  The headers or library files could not be found for zlib,
  a required dependency when compiling Pillow from source.

  Please see the install instructions at:
     https://pillow.readthedocs.io/en/latest/installation.html

  Traceback (most recent call last):
    File "C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py", line 864, in <module>
      setup(
    File "c:\users\csc\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
      self.run_command(cmd_name)
    File "c:\users\csc\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\csc\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
      self.build_extensions()
    File "C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py", line 694, in build_extensions
      raise RequiredDependencyException(f)
  __main__.RequiredDependencyException: zlib

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\CSC\AppData\Local\Temp\pip-install-xwue2xuw\pillow_70b2da91b4b24fe8a3af6f2412c19502\setup.py", line 918, in <module>
      raise RequiredDependencyException(msg)
  __main__.RequiredDependencyException:

  The headers or library files could not be found for zlib,
  a required dependency when compiling Pillow from source.

  Please see the install instructions at:
     https://pillow.readthedocs.io/en/latest/installation.html


  ----------------------------------------
  ERROR: Failed building wheel for Pillow

我不知道为什么会这样我安装了枕头没有任何问题但不是这个。 我什至尝试通过 git 安装它,但得到了同样的错误。 我还编辑了日志以使其简短,认为大部分内容都存在 我有:

最新的 gym 版本是 0.18.0,它与旧版本的 Pillow 兼容,但与最新的 Pillow 8.0.1 不兼容。 Python 另一方面,3.9 不支持旧版本的 Pillow。因此,请等待与 Pillow 8.0.1 兼容的新版本 gym 发布,或者发布支持旧版本 gym 的新版本 Pillow。对不起,但直到今天还没有解决方案。 问候

使用 Python 3.8 解决了这个问题。它对我有用。