| 1 |
Installing gmpy2 on Unix/Linux |
| 2 |
------------------------------ |
| 3 |
|
| 4 |
Many Linux distributions provide gmpy2 in their repositories. Please check |
| 5 |
your distribution's repositories first. |
| 6 |
|
| 7 |
Requirements |
| 8 |
------------ |
| 9 |
|
| 10 |
gmpy2 requires recent versions of GMP, MPFR and MPC. Specifically, gmpy2 |
| 11 |
requires GMP 5.0.0 or later, MPFR 3.1.0 or later, and MPC 1.0.0 or later. |
| 12 |
|
| 13 |
Quick Instructions |
| 14 |
------------------ |
| 15 |
|
| 16 |
To manually compile gmpy2, you will need to install the development libraries |
| 17 |
for Python, GMP, MPFR, and MPC are installed. The package names vary between |
| 18 |
distributions. "python-dev" or "python3.4-dev" are typical |
| 19 |
package names for the Python development files. Installing the MPC development |
| 20 |
package should automatically install the GMP and MPFR development packages. |
| 21 |
"libmpc-dev" is a typical name for the MPC development package. |
| 22 |
|
| 23 |
Once the required development libraries have been installed, compiling should |
| 24 |
be as simple as: |
| 25 |
|
| 26 |
$ cd <gmpy2 source directory> |
| 27 |
$ python setup.py build_ext |
| 28 |
$ sudo python setup.py install |
| 29 |
|
| 30 |
If this fails, read on. |
| 31 |
|
| 32 |
Detailed Instructions |
| 33 |
--------------------- |
| 34 |
|
| 35 |
If your Linux distribution does not support recent versions of GMP, MPFR and |
| 36 |
MPC, you will need to compile your own versions. To avoid any possible conflict |
| 37 |
with existing libraries on your system, it is recommended to build a statically |
| 38 |
linked version of gmpy2. The following instructions assume the GMP, MPFR, MPC, |
| 39 |
and gmpy2 source files are all located in $HOME/src and the static libraries |
| 40 |
are installed into $HOME/static |
| 41 |
|
| 42 |
1. Create the desired destination directory for the GMP, MPFR, and MPC |
| 43 |
libraries. |
| 44 |
|
| 45 |
$ mkdir $HOME/static |
| 46 |
|
| 47 |
2. Download and un-tar the GMP source code. Change to GMP source directory and |
| 48 |
compile GMP. |
| 49 |
|
| 50 |
$ cd $HOME/src/gmp-6.0.0 |
| 51 |
$ ./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic |
| 52 |
$ make |
| 53 |
$ make check |
| 54 |
$ make install |
| 55 |
|
| 56 |
3. Download and un-tar the MPFR source code. Change to MPFR source directory |
| 57 |
and compile MPFR. |
| 58 |
|
| 59 |
$ cd $HOME/src/mpfr-3.1.2 |
| 60 |
$ ./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static |
| 61 |
$ make |
| 62 |
$ make check |
| 63 |
$ make install |
| 64 |
|
| 65 |
4. Download and un-tar the MPC source code. Change to MPC source directory |
| 66 |
and compile MPC. |
| 67 |
|
| 68 |
$ cd $HOME/src/mpc-1.0.3 |
| 69 |
$ ./configure --prefix=$HOME/static --enable-static --disable-shared --with-pic --with-gmp=$HOME/static --with-mpfr=$HOME/static |
| 70 |
$ make |
| 71 |
$ make check |
| 72 |
$ make install |
| 73 |
|
| 74 |
5. Compile gmpy2 and specify the location of GMP, MPFR and MPC. |
| 75 |
|
| 76 |
$ cd $HOME/src/gmpy2-2.1.0 |
| 77 |
$ python setup.py build_ext --static=$HOME/static install |
| 78 |
|
| 79 |
If you get a "permission denied" error message, you may need to use: |
| 80 |
|
| 81 |
$ python setup.py build_ext --static=$HOME/static |
| 82 |
$ sudo python setup.py install |
| 83 |
|
| 84 |
Installing gmpy2 on Windows |
| 85 |
--------------------------- |
| 86 |
|
| 87 |
Please see windows_build.txt (preferred) or msys2_build.txt (alpha). |
| 88 |
|
| 89 |
|