gpt4 book ai didi

Python:Windows 10 上的 "pip install gmpy"返回 "cl.exe' 失败,退出状态为 2”

转载 作者:行者123 更新时间:2023-12-02 19:49:49 24 4
gpt4 key购买 nike

我已经在 Windows10 上安装了 Pyhton 3.7,当我运行 pip install gmpy 时,控制台向我返回此错误:

Collecting gmpy
Using cached https://files.pythonhosted.org/packages/26/37/2184c13cee81e1dbeaebbb13570195247e73ab2138a3db0c9d2c5347e372/gmpy-1.17.zip
Building wheels for collected packages: gmpy
Building wheel for gmpy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\franc\AppData\Local\Temp\pip-wheel-nz4_kuat' --python-tag cp37
cwd: C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\
Complete output (12 lines):
running bdist_wheel
running build
running build_ext
building 'gmpy' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" "-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/gmpy.c /Fobuild\temp.win-amd64-3.7\Release\src/gmpy.obj
gmpy.c
C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for gmpy
Running setup.py clean for gmpy
Failed to build gmpy
Installing collected packages: gmpy
Running setup.py install for gmpy ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\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\franc\AppData\Local\Temp\pip-record-q7ltkyyx\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\
Complete output (12 lines):
running install
running build
running build_ext
building 'gmpy' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um" "-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/gmpy.c /Fobuild\temp.win-amd64-3.7\Release\src/gmpy.obj
gmpy.c
C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\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\franc\AppData\Local\Temp\pip-record-q7ltkyyx\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

错误在这一行:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

基本上,这意味着 Python 需要 cl.exe 并且它期望它在:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x64

没问题,我转到环境变量,并为我的用户和系统添加该路径:

enter image description here

然后,我通过在终端中键入 cl 来检查 cl.exe 是否成功位于路径中,并且它有效:

enter image description here

但是当我再次运行pip install gmpy时,我遇到了同样的错误。

编辑:我也尝试过使用pip install gmpy2,但收到了相同的错误。

我哪里错了?

最佳答案

实际问题是您缺少一些头文件gmp.h:

C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory

我建议你尝试gmpy2 ,这是一个较新的版本。它在 PyPI 上有适用于 Windows 的轮子,但不幸的是,它们适用于旧版本的 Python。适用于最新 Python 版本的预构建轮可供使用 here 。这些文件以 Python 版本(例如 CPython 3.7 的 cp37)和体系结构(例如 64 位的 amd64)命名

轮子可以像这样安装:

pip install gmpy2‑2.0.8‑cp37‑cp37m‑win_amd64.whl

关于Python:Windows 10 上的 "pip install gmpy"返回 "cl.exe' 失败,退出状态为 2”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58421429/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com