如何解决在 Python/PIP 中安装 REBOUND 时出错:...Microsoft Visual Studio\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
我在 Python 上通过 pip 安装 Rebound 时遇到问题。我使用以下命令初始化安装:
pip3 install rebound
输出以以下内容开头:
Collecting rebound
Using cached rebound-3.14.0.tar.gz (250 kB)
Using legacy 'setup.py install' for rebound,since package 'wheel' is not installed.
Installing collected packages: rebound
Running setup.py install for rebound ... \
然后出现错误:
Running setup.py install for rebound ... \ WARNING: Subprocess output does not appear to be encoded as cp1250
error
ERROR: Command errored out with exit status 1:
command: 'c:\users\jacob\appdata\local\programs\python\python39\python.exe' -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\Jacob\\AppData\\Local\\Temp\\pip-install-clca5gs3\\rebound_a19ceff23d4844dfb1d9ce4d08fba984\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jacob\\AppData\\Local\\Temp\\pip-install-clca5gs3\\rebound_a19ceff23d4844dfb1d9ce4d08fba984\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record 'C:\Users\Jacob\AppData\Local\Temp\pip-record-8w1f5up7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\jacob\appdata\local\programs\python\python39\Include\rebound'
cwd: C:\Users\Jacob\AppData\Local\Temp\pip-install-clca5gs3\rebound_a19ceff23d4844dfb1d9ce4d08fba984\
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\rebound
copying rebound\citations.py -> build\lib.win-amd64-3.9\rebound
copying rebound\data.py -> build\lib.win-amd64-3.9\rebound
copying rebound\horizons.py -> build\lib.win-amd64-3.9\rebound
copying rebound\interruptible_pool.py -> build\lib.win-amd64-3.9\rebound
copying rebound\particle.py -> build\lib.win-amd64-3.9\rebound
copying rebound\plotting.py -> build\lib.win-amd64-3.9\rebound
copying rebound\simulation.py -> build\lib.win-amd64-3.9\rebound
copying rebound\simulationarchive.py -> build\lib.win-amd64-3.9\rebound
copying rebound\tools.py -> build\lib.win-amd64-3.9\rebound
copying rebound\units.py -> build\lib.win-amd64-3.9\rebound
copying rebound\widget.py -> build\lib.win-amd64-3.9\rebound
copying rebound\__init__.py -> build\lib.win-amd64-3.9\rebound
copying rebound\rebound.h -> build\lib.win-amd64-3.9\rebound
running build_ext
building 'librebound' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DLIBREBOUND -Isrc -Ic:\users\jacob\appdata\local\programs\python\python39\include -Ic:\users\jacob\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcsrc/binarydiff.c /Fobuild\temp.win-amd64-3.9\Release\src/binarydiff.obj -fstrict-aliasing -O3 -std=c99 -Wno-unknown-pragmas -DGITHASH=eb1f3890ab7f01487de2b3d01c42c1acdfd9d5e5 -DLIBREBOUND -D_GNU_SOURCE -fPIC
cl : Wiersz polecenia error D8021 : nieprawid\x88owy argument numeryczny "/Wno-unknown-pragmas"
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\jacob\appdata\local\programs\python\python39\python.exe' -u -c 'import sys,'"'"'exec'"'"'))' install --record 'C:\Users\Jacob\AppData\Local\Temp\pip-record-8w1f5up7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\jacob\appdata\local\programs\python\python39\Include\rebound' Check the logs for full command output.
知道有什么问题吗?它显然与 MSVC 相关。一开始有一个错误,需要 MSVC 版本。要安装 14 或更高版本。安装MSVC后,出现上述错误。
Python 版本。 3.9 点子版。 21.0
解决方法
setup.py
添加了许多特定于 gcc
的编译器标志。似乎the authors don't expect the code to be used on w32。仅支持 Linux 和 MacOS X。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。