安装 cocos2d 失败

一、安装 cocos2d 失败

试过大部分的网上的解决方案:
1.pip换python.exe
2.更换国内清华路径
3.路径后加信任:--trusted-host
4.更新setuptools
5.更新 pip
都不行。。

报错信息如下:

PS D:\practiceProject\Games> pip install cocos2d 
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting cocos2d
  Using cached https://mirrors.aliyun.com/pypi/packages/2f/45/d3efb5f3e635adc5b49ee2b890910c672f4c98b927a820230abadde9c9bf/cocos2d-0.6.9.tar.gz (4.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      Traceback (most recent call last):
        File "", line 2, in 
        File "", line 34, in 
        File "C:\Users\2\AppData\Local\Temp\pip-install-hv_ehjsj\cocos2d_4c205c14ac5c4f9a93bd317df50fe00d\setup.py", line 38, in 
          f = open('README.rst','rU')
              ^^^^^^^^^^^^^^^^^^^^^^^
      ValueError: invalid mode: 'rU'
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

如有 “大ge” 知晓怎么回事,麻烦告知!感谢!

命令换成 python -m pip install cocos2d
或者卸载setuptools,重新安装

这可能是由于您的python版本太低导致的,您可以尝试升级您的python版本,以确保cocos2d的安装能够正常进行。此外,您还可以尝试使用其他的安装方式,比如使用源码安装或者使用docker安装。