2014-09-06 24 views
1

我安裝gmpy2這樣的:如何安裝gmpy2錯誤:「MPFR_RNDU」未申報(第一次在這個函數中使用)

yum install gmp-devel 
yum install mpfr-devel 
yum install libmpc-devel 

,但顯示這些錯誤:

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘real_round’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘real_round’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘imag_round’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘underflow’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘trap_underflow’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘overflow’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘trap_overflow’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘inexact’ 

src/gmpy_mpc.c:1294: error: ‘gmpy_context’ has no member named ‘trap_inexact’ 

.......... 


src/gmpy2.c:969: error: ‘MPFR_RNDU’ undeclared (first use in this function) 

src/gmpy2.c:970: error: ‘MPFR_RNDD’ undeclared (first use in this function) 

src/gmpy2.c:971: error: ‘MPFR_RNDA’ undeclared (first use in this function) 

error: command 'gcc' failed with exit status 1 

有什麼錯?我已經安裝了gmp,mpfr,mpc和他們的devel ,,, 但仍然有這麼多錯誤。爲什麼?

回答

1

我是gmpy2的維護者。

gmpy2要求相對較新版本的MPFR和MPC。如果setup.py無法找到合適的版本,它會顯示以下警告消息:

---------------------------------------------------------------- 
setup.py was not able to detect the required versions of MPFR 
and/or MPC. gmpy2 requires MPFR version 3.1.0 or greater and 
MPC version 1.0.0 or greater. To specify a directory prefix that 
contains the proper versions, use the --prefix=<dir> option. 

In some circumstances, the correct versions may be present and 
this warning can be ignored. If you have difficulties compiling 
or running gmpy2, please try compiling with the --prefix option. 

It is possible to compile gmpy2 without support for MPFR and MPC 
but that is not a supported configuration. Beginning with v2.1.0, 
MPFR and MPC will be required. 

setup.py will continue and attempt to compile gmpy2. 
----------------------------------------------------------------- 

如果您不能安裝最新的GMP,MPFR和MPC的版本,那麼你就需要編譯自己的GMP,MPFR和MPC版本,然後指示setup.py使用您的版本。我通常將我的副本安裝到/opt/local。以下說明假定來源位於/opt/local/src,並且您正在使用具有sudo訪問權限的管理員帳戶。

$ cd /opt/local/src/gmp-6.0.0 
$ ./configure --prefix=/opt/local 
$ make 
$ make check 
$ make install 
$ cd /opt/local/src/mfr-3.1.2 
$ ./configure --prefix=/opt/local --with-gmp=/opt/local 
$ make 
$ make check 
$ make install 
$ cd /opt/local/src/mpc-1.0.2 
$ ./configure --prefix=/opt/local --with-gmp=/opt/local --with-mpfr=/opt/local 
$ make 
$ make check 
$ make install 
$ cd /opt/local/src/gmpy2-2.0.3 
$ python setup.py build_ext --prefix=/opt/local 
$ sudo python setup.py install 

如果您需要在各種系統分配gmpy2庫(用於實驗室或計算機集羣),就可以編譯靜態鏈接的版本。如果您需要這些說明,請告訴我。

+0

謝謝。它有助於。 – 2014-09-07 12:17:31

相關問題