python setup.py bdist_wheel 没有运行成功

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

我只想安装 nes_py,但收到以下错误消息:

Collecting nes_py
  Using cached nes_py-8.1.8.tar.gz (76 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: gym>=0.17.2 in c:\users\hb\appdata\roaming\python\python310\site-packages (from nes_py) (0.23.0)
Requirement already satisfied: numpy>=1.18.5 in c:\users\hb\appdata\roaming\python\python310\site-packages (from nes_py) (1.22.3)
Requirement already satisfied: pyglet<=1.5.11,>=1.4.0 in c:\users\hb\appdata\roaming\python\python310\site-packages (from nes_py) (1.5.11)
Requirement already satisfied: tqdm>=4.48.2 in c:\users\hb\appdata\roaming\python\python310\site-packages (from nes_py) (4.63.0)
Requirement already satisfied: cloudpickle>=1.2.0 in c:\users\hb\appdata\roaming\python\python310\site-packages (from gym>=0.17.2->nes_py) (2.0.0)
Requirement already satisfied: gym-notices>=0.0.4 in c:\users\hb\appdata\roaming\python\python310\site-packages (from gym>=0.17.2->nes_py) (0.0.6)
Requirement already satisfied: colorama in c:\users\hb\appdata\roaming\python\python310\site-packages (from tqdm>=4.48.2->nes_py) (0.4.4)
Building wheels for collected packages: nes_py
  Building wheel for nes_py (setup.py): started
  Building wheel for nes_py (setup.py): finished with status 'error'
  Running setup.py clean for nes_py
Failed to build nes_py
Installing collected packages: nes_py, gym_super_mario_bros
  Running setup.py install for nes_py: started
  Running setup.py install for nes_py: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
Output exceeds the size limit. Open the full output data in a text editor
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [129 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\nes_py
      copying nes_py\nes_env.py -> build\lib.win-amd64-3.10\nes_py
      copying nes_py\_image_viewer.py -> build\lib.win-amd64-3.10\nes_py
      copying nes_py\_rom.py -> build\lib.win-amd64-3.10\nes_py
      copying nes_py\__init__.py -> build\lib.win-amd64-3.10\nes_py
      creating build\lib.win-amd64-3.10\nes_py\app
      copying nes_py\app\cli.py -> build\lib.win-amd64-3.10\nes_py\app
      copying nes_py\app\play_human.py -> build\lib.win-amd64-3.10\nes_py\app
      copying nes_py\app\play_random.py -> build\lib.win-amd64-3.10\nes_py\app
      copying nes_py\app\__init__.py -> build\lib.win-amd64-3.10\nes_py\app
      creating build\lib.win-amd64-3.10\nes_py\wrappers
      copying nes_py\wrappers\joypad_space.py -> build\lib.win-amd64-3.10\nes_py\wrappers
      copying nes_py\wrappers\__init__.py -> build\lib.win-amd64-3.10\nes_py\wrappers
      running build_ext
      building 'nes_py.lib_nes_env' extension
...
╰─> nes_py

我已经尝试过的:

  • pip install nes-py --no-cache-dir
  • pip install --升级 pip setuptools 轮

我的系统:

  • Windows 10
  • Python 3.10.2 64 位
  • Visual Studio 代码
python python-3.x
5个回答
23
投票

我也有类似的问题,但安装 Cmake 后一切都很好

pip install Cmake

5
投票

尝试使用以下命令安装Cmake

pip install Cmake

引发此错误的原因是某些 Python 包包含需要编译和链接才能正常工作的本机扩展。这些本机扩展可能是用 C、C++ 或其他语言编写的,并且它们可能使用需要在系统上安装的第三方库或框架。

在这种情况下,cmake 可用于配置、构建和打包 Python 包的本机扩展。 cmake 工具帮助管理构建过程和依赖项,并为构建系统生成必要的文件,以将本机扩展编译并打包到 Wheel 发行版中。


5
投票

我在 Windows 10 PC 上尝试运行 SikuliX 脚本时遇到了同样的错误。我是这样解决的:

  1. 下载并运行 C++ 构建工具:https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. 打开并选择“Individual Components”选项卡并安装 MSVC - v140 VS2015 C++ Build Tools (v14.00) 以及 Windows 10 SDK,例如 10.0.20348.0

  3. 向环境变量 PATH 添加新值:C:\Program Files (x86)\Windows Kits in\x64

  4. 复制文件
    rc.exe
    rcdll.dll

C:\Program Files (x86)\Windows Kits in .0.20348.0\x64

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC 中

  1. 现在执行之前产生错误的命令:

python setup.py bdist_wheel 没有运行成功。


1
投票

我在虚拟环境中的 docker 容器中运行

pip install
时遇到了这个问题

当我停止使用 virtualenv 并从

python3

运行时,问题就解决了

-1
投票

这个错误可能是因为你没有安装wheel包造成的。根据您的系统,在这个简短、简单且令人惊叹的教程中查看如何安装wheel包。安装wheel包后,您可以通过运行

pip install nes-py
来安装nes。确保安装 Visual-Studio 17.0 工具,以便 nes 包可以在 Windows 上运行。

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