2

I want to use a python script which imports gmpy. However, python always tells me:

ImportError: No module named 'gmpy'

I am on Ubuntu 14.04 i686 and I tried to install gmpy over various ways:

  1. sudo pip install gmpy
  2. sudo pip install gmpy2
  3. sudo apt-get install python-gmpy*
  4. sudo apt-get install python2.7-gmpy*
  5. sudo apt-get install python3-gmpy*
  6. I also followed the officiel instruction on building gmpy from source (I also compiled MPC, MPFR, and GMP from source for this reason).

Obviously I am using python 3.4.0:

$ python
$ Python 3.4.0 (default, Apr 11 2014, 13:05:18)
  [GCC 4.8.2] on linux

What am I missing such that python is not able to find the gmpy libs?

4

2 回答 2

2

以下任何解决方案都解决了该问题:

sudo pip3 install gmpy(我在使用 python3 时执行了错误的点子)

或者

$ python2.7 script.py(或者干脆使用python2解释器)

于 2014-06-03T14:06:05.740 回答
1
  • apt-get -f 安装
  • pip2 安装 gmpy

完毕。

于 2017-04-05T13:24:24.823 回答