简体   繁体   English

Python无法找到gmpy库

[英]Python unable to locate gmpy library

I want to use a python script which imports gmpy. 我想使用导入gmpy的python脚本。 However, python always tells me: 但是,python总是告诉我:

ImportError: No module named 'gmpy'

I am on Ubuntu 14.04 i686 and I tried to install gmpy over various ways: 我在Ubuntu 14.04 i686上,尝试通过各种方式安装gmpy:

  1. sudo pip install gmpy 须藤点安装gmpy
  2. sudo pip install gmpy2 须藤点安装gmpy2
  3. sudo apt-get install python-gmpy* 须藤apt-get install python-gmpy *
  4. sudo apt-get install python2.7-gmpy* 须藤apt-get install python2.7-gmpy *
  5. sudo apt-get install python3-gmpy* 须藤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). 我还遵循了有关从源代码构建gmpy的officeiel指令(因此,我也从源代码编译了MPC,MPFR和GMP)。

Obviously I am using python 3.4.0: 显然我正在使用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? 我缺少什么使python无法找到gmpy库?

Any of the following solutions solved the problem: 以下任何解决方案均可以解决该问题:

sudo pip3 install gmpy (I executed the wrong pip as I am using python3) sudo pip3 install gmpy (我使用python3时执行了错误的pip)

or 要么

$ python2.7 script.py (Or simply use python2 interpreter) $ python2.7 script.py (或者简单地使用python2解释器)

  • apt-get -f install apt-get -f安装
  • pip2 install gmpy pip2安装gmpy

Done. 完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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