本文介绍了GMPY2未安装,找不到mpir.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to install gmpy2 on my Anaconda Python 3.5 distribution using pip. I was able to install other modules such as primefac perfectly. When I try to install gmpy2 this is what I get:

(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时,总会出现某种错误,并且每次都不同.有人可以告诉我如何解决此问题.

I have noticed that whenever I try installing gmpy2 on a computer I always get some sort of error and it is a different one every time. Can someone please tell me how to fix this.

谢谢.

推荐答案

我维护gmpy2,但是不幸的是,我无法为Python 3.5和更高版本构建Windows二进制文件. gmpy2依赖于MPIR或GMP库以及MPFR和MPC库.源代码分发中包含详细的说明,但在Windows上构建它们并不容易.通过pip构建MPIR,MPFR和MPC可能是不可能的(*).我会使用 http://www.lfd.uci.edu上可用的预编译二进制文件/〜gohlke/pythonlibs/

I maintain gmpy2 and unfortunately I have not been able to build Windows binaries for Python 3.5 and later. gmpy2 relies on either the MPIR or GMP libraries, and the MPFR and MPC libraries. There are detailed instructions included in the source distribution but they are not trivial to build on Windows. It is probably impossible(*) to build MPIR, MPFR, and MPC via pip. I would use the pre-compiled binaries available from http://www.lfd.uci.edu/~gohlke/pythonlibs/

(*)我敢肯定,只要有足够的努力,就有可能实现,但是我还没有做到.

(*) I'm sure it is possible with enough effort but I haven't done it.

这篇关于GMPY2未安装,找不到mpir.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 07:22