当前位置:   article > 正文

解决nes_py在pip安装报错的问题_failed building wheel for nes-py

failed building wheel for nes-py

目录

项目场景:

问题描述

原因分析:

解决方案:

解决结果:


项目场景:

想跟随油管某视频复现强化学习方法玩超级马里奥的过程,结果在在Anaconda3虚拟环境中用pip安装nes_py时一直报错,报错信息如下:

  1. Building wheel for nes-py (setup.py) ... error
  2. error: subprocess-exited-with-error
  3. × python setup.py bdist_wheel did not run successfully.
  4. exit code: 1
  5. ╰─> [21 lines of output]
  6. running bdist_wheel
  7. running build
  8. running build_py
  9. creating build
  10. creating build\lib.win-amd64-cpython-37
  11. creating build\lib.win-amd64-cpython-37\nes_py
  12. copying nes_py\nes_env.py -> build\lib.win-amd64-cpython-37\nes_py
  13. copying nes_py\_image_viewer.py -> build\lib.win-amd64-cpython-37\nes_py
  14. copying nes_py\_rom.py -> build\lib.win-amd64-cpython-37\nes_py
  15. copying nes_py\__init__.py -> build\lib.win-amd64-cpython-37\nes_py
  16. creating build\lib.win-amd64-cpython-37\nes_py\app
  17. copying nes_py\app\cli.py -> build\lib.win-amd64-cpython-37\nes_py\app
  18. copying nes_py\app\play_human.py -> build\lib.win-amd64-cpython-37\nes_py\app
  19. copying nes_py\app\play_random.py -> build\lib.win-amd64-cpython-37\nes_py\app
  20. copying nes_py\app\__init__.py -> build\lib.win-amd64-cpython-37\nes_py\app
  21. creating build\lib.win-amd64-cpython-37\nes_py\wrappers
  22. copying nes_py\wrappers\joypad_space.py -> build\lib.win-amd64-cpython-37\nes_py\wrappers
  23. copying nes_py\wrappers\__init__.py -> build\lib.win-amd64-cpython-37\nes_py\wrappers
  24. running build_ext
  25. building 'nes_py.lib_nes_env' extension
  26. error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  27. [end of output]
  28. note: This error originates from a subprocess, and is likely not a problem with pip.
  29. ERROR: Failed building wheel for nes-py
  30. Running setup.py clean for nes-py
  31. Failed to build nes-py
  32. Installing collected packages: nes-py, gym_super_mario_bros
  33. Running setup.py install for nes-py ... error
  34. error: subprocess-exited-with-error
  35. × Running setup.py install for nes-py did not run successfully.
  36. exit code: 1
  37. ╰─> [23 lines of output]
  38. running install
  39. D:\Anaconda3\envs\rlgame\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  40. setuptools.SetuptoolsDeprecationWarning,
  41. running build
  42. running build_py
  43. creating build
  44. creating build\lib.win-amd64-cpython-37
  45. creating build\lib.win-amd64-cpython-37\nes_py
  46. copying nes_py\nes_env.py -> build\lib.win-amd64-cpython-37\nes_py
  47. copying nes_py\_image_viewer.py -> build\lib.win-amd64-cpython-37\nes_py
  48. copying nes_py\_rom.py -> build\lib.win-amd64-cpython-37\nes_py
  49. copying nes_py\__init__.py -> build\lib.win-amd64-cpython-37\nes_py
  50. creating build\lib.win-amd64-cpython-37\nes_py\app
  51. copying nes_py\app\cli.py -> build\lib.win-amd64-cpython-37\nes_py\app
  52. copying nes_py\app\play_human.py -> build\lib.win-amd64-cpython-37\nes_py\app
  53. copying nes_py\app\play_random.py -> build\lib.win-amd64-cpython-37\nes_py\app
  54. copying nes_py\app\__init__.py -> build\lib.win-amd64-cpython-37\nes_py\app
  55. creating build\lib.win-amd64-cpython-37\nes_py\wrappers
  56. copying nes_py\wrappers\joypad_space.py -> build\lib.win-amd64-cpython-37\nes_py\wrappers
  57. copying nes_py\wrappers\__init__.py -> build\lib.win-amd64-cpython-37\nes_py\wrappers
  58. running build_ext
  59. building 'nes_py.lib_nes_env' extension
  60. error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  61. [end of output]
  62. note: This error originates from a subprocess, and is likely not a problem with pip.
  63. error: legacy-install-failure
  64. × Encountered error while trying to install package.
  65. ╰─> nes-py
  66. note: This is an issue with the package mentioned above, not pip.
  67. hint: See above for output from the failure.

问题描述

从上面的报错信息可以得知,我们的问题在于没有找到wheel,说明本地没有相关配置。而最后一行也告诉我们提示:不是pip的问题,而是上述提到的包(nes)的问题,所以看上面的报错信息找原因。

原因分析:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

发现上述一行报错信息:说明我们本地缺少msvc的组件。

原来是我前段时间为了给C盘瘦身,把VS给全部清理了,因为目前主要精力在Python上。

那这就好办了,去他给的官网下载就是了。


解决方案:

下载官网文件

https://download.visualstudio.microsoft.com/download/pr/0502e0d3-64a5-4bb8-b049-6bcbea5ed247/d7293c5775ad824c05ee99d071d5262da3e7653d39f3ba8a28fb2917af7c041a/vs_BuildTools.exe

下载完成以后是VS Installer,这次我们修改安装路径,不要放C盘了,我们在D盘新建文件夹叫Workspace,把其余路径原封不动搞进去

刚刚安装忘记截图了,总之就是这个路径,vs文件夹下还有个package文件夹,一共两个路径。

最后点击安装就完成了! 

注意一定要勾选C++桌面开发 


解决结果:

安装依赖以后成功安装 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/47034
推荐阅读
相关标签
  

闽ICP备14008679号