Skip to main content
 首页 » 编程设计

python之如何在 pythonanywhere 上安装 GNU MPFR 库

2025年05月04日9lonelyxmas

我正在尝试安装 bigfloat,但收到此消息似乎表明我首先需要 mpfr 库。我该怎么做?
讯息:

running build_ext building 'mpfr' extension creating build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c mpfr. c -o build/temp.linux-x86_64-2.7/mpfr.o mpfr.c:344:18: fatal error: mpfr.h: No such file or directory #include "mpfr.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我是 python 和 pythonanywhere 的新手,所以我不知道如何安装库。

我试图找到如何使用谷歌安装一个库,我尝试使用:

pip install --user mpfr  

但我收到此错误消息:

Collecting mpfr Could not find a version that satisfies the requirement mpfr (from versions: ) No matching distribution found for mpfr

请您参考如下方法:

gmpy2 是用 C 编写的,并且依赖于其他三个 C 库:GMP、MPFR 和 MPC。确保所有依赖项都存在的最简单方法是使用 Linux 发行版中的标准包管理工具“libmpc-dev”。 例如:

sudo apt-get install libmpc-dev