Skip to main content
 首页 » 编程设计

python之安装 Python bigfloat 模块

2025年05月04日11mq0036

我正在尝试将 bigfloat Python 包安装到我的 mac 上,但我不太擅长这类事情。

我已经按照描述下载了最新的包 here .文档说:

In order to use the bigfloat package you will need to have both the GMP and MPFR libraries already installed on your system. 

我认为我的系统上已经安装了 GMP 和 MPFR 库 - 至少当我搜索它们时,我看到了包含它们的名称和文件的文件夹。

当我尝试通过键入来安装 bigfloat 时:

python setup.py install 

我收到很多错误信息。第一个是:

src/mpfr.c:223:17: error: gmp.h: No such file or directory 
src/mpfr.c:224:18: error: mpfr.h: No such file or directory 

gmp.h 和 mpfr.h 文件在我的电脑上,但显然我需要做其他事情。

Cleary 我不明白整个过程是如何运作的,但任何指向正确方向的指示都会很棒。谢谢。

请您参考如下方法:

首先,您需要安装 GMP 和 MPFR 库。

sudo apt-get install libmpfr-dev 

然后运行:

 sudo pip install bigfloat 

问候!