python - 使用 conda 在 WSL ubuntu 中安装 nes-py 时出现问题

标签 python ubuntu pip g++

我试图使用 pip install nes-py 在 WSL 中安装 nes-py ,但我收到以下错误(我正在粘贴整个终端消息)。

Collecting nes-py
  Using cached nes_py-8.1.8.tar.gz (76 kB)
Requirement already satisfied: gym>=0.17.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (0.21.0)
Requirement already satisfied: numpy>=1.18.5 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.20.3)
Requirement already satisfied: pyglet<=1.5.11,>=1.4.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.5.11)
Requirement already satisfied: tqdm>=4.48.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (4.62.3)
Requirement already satisfied: cloudpickle>=1.2.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from gym>=0.17.2->nes-py) (2.0.0)
Building wheels for collected packages: nes-py
  Building wheel for nes-py (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-84x8fqpu
       cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
  Complete output (27 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
  creating build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
  creating build/lib.linux-x86_64-3.9/nes_py/wrappers
  copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
  copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
  running build_ext
  building 'nes_py.lib_nes_env' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/nes_py
  creating build/temp.linux-x86_64-3.9/nes_py/nes
  creating build/temp.linux-x86_64-3.9/nes_py/nes/src
  creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
  g++ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c++1y -march=native -pipe -O3
  error: command 'g++' failed: No such file or directory
  ----------------------------------------
  ERROR: Failed building wheel for nes-py
  Running setup.py clean for nes-py
Failed to build nes-py
Installing collected packages: nes-py
    Running setup.py install for nes-py ... error
    ERROR: Command errored out with exit status 1:
     command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py
         cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
    Complete output (27 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
    creating build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
    creating build/lib.linux-x86_64-3.9/nes_py/wrappers
    copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
    copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
    running build_ext
    building 'nes_py.lib_nes_env' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/nes_py
    creating build/temp.linux-x86_64-3.9/nes_py/nes
    creating build/temp.linux-x86_64-3.9/nes_py/nes/src
    creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
    g++ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c++1y -march=native -pipe -O3
    error: command 'g++' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py Check the logs for full command output.
我尝试了许多修复,例如克隆 nes-py 存储库并通过运行 python setup.py install 安装它在其目录中,更改 MANIFEST.in 文件和其他一些文件,但没有任何效果。如果有人能以任何方式提供帮助,那就太棒了!
提前致谢!
附言我是使用 Conda 和 WSL/Ubuntu 的新手,因此也感谢这方面的任何帮助。我以前只是使用与 VS Code 集成的 cmd。

最佳答案

找到了解决方案。花了一段时间,但这是一个简单的。我只需要通过运行 sudo apt install g++ 来安装 g++在终端。在那之后,nes-py 安装就像一个魅力。

关于python - 使用 conda 在 WSL ubuntu 中安装 nes-py 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70528648/

相关文章:

python - 无法安装 Django - 无法获取索引基 URL https ://pypi. python.org/simple/

python - 将缺失值保留为 'NaN' 的 LabelEncoder

python - 使用不同 matplotlib 版本绘图的差异

python - Google App Engine 中的证书存储

ubuntu - 在 Ubuntu (v14.04) 上卸载 Genymotion (v2.2.2)

python - 使用 pip 从存储库安装软件包时,(s)witch、(i)gnore、(w)ipe、(b)ackup 选项是什么意思?

python - 在具有一个键多个值的字典中添加列表或字典 - Python

linux - 如何重置 bash 配置?

angular - Ubuntu 16.04 上的 NPM 安装错误,但 Windows 10 上没有

python - 无法在 python 3.7 上安装 igraph