2

我正在尝试将 bigfloat Python 包放到我的 Mac 上,但我不太擅长这种事情。

我已经下载了这里描述的最新包。文档说:

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 文件在我的电脑上,但显然我需要做些别的事情。

显然,我不明白整个过程是如何运作的,但是任何朝着正确方向的指针都会很棒。谢谢你。

4

3 回答 3

1

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

sudo apt-get install libmpfr-dev

然后运行:

 sudo pip install bigfloat

问候!

于 2015-05-07T00:41:13.293 回答
0

I'm having the same problem and here's what I've tried as per the readme file in the bigfloat installation directory:

"An example: on Mac OS X, using the system Python, but with MPFR and GMP installed in /opt/local (e.g., by MacPorts), one can do":

LIBRARY_PATH=/opt/local/lib CPATH=/opt/local/include python setup.py build

This didn't throw any errors, but when I checked to see if it installed by running this test:

python -m bigfloat.test.test_bigfloat

I got the error:

/Library/Frameworks/Python.framework/Versions/7.2/Resources/Python.app/Contents/MacOS/Python: No module named mpfr  

You can give this a try to see if it works for you, but I'm still lost.

What you should get if it's a successful installation is this:

the bigfloat-0.3.0a1/ directory that you created can now be deleted.
于 2013-06-25T20:41:35.807 回答
0

我在我的 Mac (v10.10.3) 上通过 easy_install 和 pip 安装 python bigfloat 时遇到了问题,并且遇到了类似的错误问题;这是因为 bigfloat 需要几个其他库。

根据这个答案

我安装了 gmp & mpfr 库,然后 pip 将正确安装

pip install bigfloat

或者

pip3.5 install bigfloat
于 2016-03-21T06:23:48.400 回答