Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

python - GMPY2 Not installing, mpir.h not found

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 FilesAnaconda3) C:WINDOWSsystem32>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 FilesAnaconda3python.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('
', '
'), __file__, 'exec'))" bdist_wheel -d C:UsersHADIKH~1AppDataLocalTempmplefsjn80pip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_ext
  building 'gmpy2' extension
  creating build
  creating buildemp.win-amd64-3.5
  creating buildemp.win-amd64-3.5Release
  creating buildemp.win-amd64-3.5Releasesrc
  C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMPIR -DWITHMPFR -DWITHMPC "-IC:Program FilesAnaconda3include" "-IC:Program FilesAnaconda3include" "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE" "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCATLMFCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits8.1include\shared" "-IC:Program Files (x86)Windows Kits8.1include\um" "-IC:Program Files (x86)Windows Kits8.1include\winrt" /Tcsrcgmpy2.c /Fobuildemp.win-amd64-3.5Releasesrcgmpy2.obj
  gmpy2.c
  c:usershadi khanappdatalocalemppip-build-hd7b270ngmpy2srcgmpy.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

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.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The reason is some required packages (especially below packages) aren't installed.

  • GMP: GNU Multiple Precision Arithmetic Library
  • MPFR: GNU Multiple-precision floating-point rounding library
  • MPC: GNU Multiple-precision C library

you could install those packages by below commands:

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

I could install gmpy2 by installing those libraries.

the key point is remembering below hint when you got an error like above.

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...