简体   繁体   English

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

[英]Python: “pip install gmpy” on Windows 10 returns “cl.exe' failed with exit status 2”

I've installed Pyhton 3.7 on Windows10 and when I run pip install gmpy the console return me this error:我已经在 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.

The error is in this line:错误在这一行:

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

Basically it means that Python needs cl.exe and it expect it at:基本上这意味着 Python 需要cl.exe并且它期望它在:

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

No problem, I go to the Environment Variable and i add that path both for my user and for the system:没问题,我将 go 添加到环境变量中,并为我的用户和系统添加了该路径:

在此处输入图像描述

Then I check if cl.exe is successfully in the path by typing cl in the terminal and it works:然后我通过在终端中键入cl来检查cl.exe是否在路径中成功并且它可以工作:

在此处输入图像描述

But when I run again pip install gmpy I have the same error.但是当我再次运行pip install gmpy我有同样的错误。

EDIT: I also tried with pip install gmpy2 and I receive the same error.编辑:我也尝试使用pip install gmpy2并收到相同的错误。

Where am I wrong?我哪里错了?

Well the actual problem is that you are missing some header file gmp.h :那么实际的问题是您缺少一些 header 文件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

I suggest you try gmpy2 , which is a newer version.我建议您尝试gmpy2 ,这是一个较新的版本。 It has wheels for Windows on PyPI but they are for older versions of Python unfortunately.它在 PyPI 上有用于 Windows 的轮子,但不幸的是它们适用于旧版本的 Python。 Pre-built wheels for more recent Python versions are available here .在此处获得适用于最新 Python 版本的预制轮毂。 The files are named after the Python version (eg cp37 for CPython 3.7) and architecture (eg amd64 for 64-bit)这些文件以 Python 版本(例如 CPython 3.7 的cp37 )和架构(例如 64 位的amd64 )命名

A wheel can be installed like so:可以像这样安装轮子:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pip 安装导致此错误“cl.exe 失败,退出代码 2” - Pip install results in this error " cl.exe' failed with exit code 2 " 错误:cl.exe失败,退出状态为2 - error:cl.exe failed with exit status 2 Windows 上的 python pip - 命令“cl.exe”失败 - python pip on Windows - command 'cl.exe' failed Python pip安装错误:命令“ C:\\\\ Program Files(x86)\\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ BIN \\\\ cl.exe”失败,退出状态为2 - Python pip install error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 pip install pyaudio 错误 cl.exe 失败 - pip install pyaudio error cl.exe failed Python 2.7.7软件包安装给出Visual C ++ cl.exe错误:命令失败,退出状态为2 - Python 2.7.7 package installation giving Visual C++ cl.exe error: command failed with exit status 2 Python pip install cvxopt 错误:命令 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\VC\\\\BIN\\\\x86_amd64\\\\cl.exe' failed with exit status 2 - Python pip install cvxopt error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2 Windows上的Python pip-命令错误“ cl.exe” - Python pip on WIndows - command error “cl.exe” C:\\\\ Program Files \\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ bin \\\\ cl.exe'失败,退出状态为2 - C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe' failed with exit status 2 通过PyCharm安装PyGObject会产生错误命令'C:\\\\…\\\\ cl.exe'失败,退出状态为2 - Installing PyGObject through PyCharm yields error command 'C:\\…\\cl.exe' failed with exit status 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM