python - GMPY2 未安装,未找到 mpir.h

标签 python windows installation gmpy

我正在尝试使用 pip 在我的 Anaconda Python 3.5 发行版上安装 gmpy2。我能够完美地安装其他模块,例如 primefac。当我尝试安装 gmpy2 时,这是我得到的:

(C:\Program Files\Anaconda3) C:\WINDOWS\system32>pip install gmpy2
Collecting gmpy2
  Using cached gmpy2-2.0.8.zip
Building wheels for collected packages: gmpy2
  Running setup.py bdist_wheel for gmpy2 ... error
  Complete output from command "C:\Program Files\Anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\HADIKH~1\\AppData\\Local\\Temp\\pip-build-hd7b270n\\gmpy2\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\HADIKH~1\AppData\Local\Temp\tmplefsjn80pip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_ext
  building 'gmpy2' extension
  creating build
  creating build\temp.win-amd64-3.5
  creating build\temp.win-amd64-3.5\Release
  creating build\temp.win-amd64-3.5\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMPIR -DWITHMPFR -DWITHMPC "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tcsrc\gmpy2.c /Fobuild\temp.win-amd64-3.5\Release\src\gmpy2.obj
  gmpy2.c
  c:\users\hadi khan\appdata\local\temp\pip-build-hd7b270n\gmpy2\src\gmpy.h(104): fatal error C1083: Cannot open include file: 'mpir.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for gmpy2

我注意到,每当我尝试在计算机上安装 gmpy2 时,我总是会遇到某种错误,而且每次都不同。谁能告诉我如何解决这个问题。

谢谢。

最佳答案

原因是一些必需的包(尤其是下面的包)没有安装。

  • GMP:GNU 多精度算术库
  • MPFR:GNU 多精度浮点舍入库
  • MPC:GNU 多精度 C 库

您可以通过以下命令安装这些软件包:

apt-get install libgmp-dev
apt-get install libmpfr-dev
apt-get install libmpc-dev

我可以通过安装这些库来安装 gmpy2。

关键是当你遇到上面的错误时,记住下面的提示。

#include "***.h": ==> No such file or directory

apt-get install lib"***"-dev

关于python - GMPY2 未安装,未找到 mpir.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40075271/

相关文章:

python - 如何更改此代码以使用上下文管理器?

windows - 在没有 ResetEvent 的情况下调用 setEvent

c# - 编码安装程序

ios - Xcode 7.3.1 - 无法正确设置 AWS

python - 如何计算累积积分?

python - 使用 Python 的 click 库的任意命令行关键字

Python - subprocess.Popen - ssh -t user@host 'service --status-all'

windows - Windows 批处理文件的隐藏功能

windows - NSIS RMDir 无法删除 ProgramData 中用户创建的文件

linux - 检查 Node 版本不返回任何内容