简体   繁体   中英

Python unable to locate gmpy library

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?

Any of the following solutions solved the problem:

sudo pip3 install gmpy (I executed the wrong pip as I am using python3)

or

$ python2.7 script.py (Or simply use python2 interpreter)

  • apt-get -f install
  • pip2 install gmpy

Done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM