I have brew install
ed mpc
and gmp
, but when I try to pip install gmpy2
I get a compile error on the line
我已经安装了brew mpc和gmp,但是当我试图安装gmpy2时,我在这行中会得到一个编译错误
#include "mpc.h"
so for some reason clang
is having trouble finding the mpc
library. I'm not sure what I should do at this point.
因此,由于某些原因,clang很难找到mpc库。我不知道现在该怎么做。
4 个解决方案
#1
4
I'm the maintainer for gmpy2. I don't have access to a Mac so I can't test OSX builds.
我是gmpy2的维护者。我无法访问Mac,所以无法测试OSX的构建。
I assume you've also installed mpfr
since it is a prerequisite of mpc
. Where are the development files (i.e. gmp.h
, mpfr.h
, and mpc.h
) located?
我假设您也安装了mpfr,因为它是mpc的先决条件。开发文件(即gmp)在哪里?h,mpfr。h,mpc.h)?
Instead of installing via pip, can you try installing from the command line? I use a command similar to:
您可以尝试从命令行安装,而不是通过pip进行安装吗?我使用的命令类似于:
python setup.py install --prefix=/opt/local --force
python的设置。py安装——prefix = / opt /当地——力量
This command assumes that the .h
files are located in /opt/local/include. You will need to adjust the prefix to suit your system.
此命令假定.h文件位于/opt/local/include中。您将需要调整前缀以适应您的系统。
#2
31
For OSX with homebrew users - I tried to do the usual dance with
对于有家酿啤酒用户的OSX,我试着和他们一起跳。
brew install mpc
brew install mpfr
and then
然后
python setup.py --prefix=/usr/local/Cellar
but got the error, that 'mpc.h' could not be found. True enough, there is no mpc.h file to be found. The solution is, to use
但是有个错误,就是mpc。找不到h。确实,没有mpc。h文件有待查找。解决办法是,使用
brew install libmpc
brew install mpfr
instead. After that gmpy2 was compiling and installing with no further problems.
代替。之后,gmpy2正在编译和安装,没有进一步的问题。
#3
9
The short and sweet 2015 answer:
2015年短暂而甜蜜的回答:
brew install mpfr
brew install libmpc
pip install gmpy2
#4
0
As of the 06 March 2018, the only thing that worked for me was the following. (Install on Mac OS High Sierra 10.13.3, for python 3.5.4)
到2018年3月06日为止,对我起作用的只有以下几点。(安装在Mac OS High Sierra 10.13.3,适用于python 3.5.4)
sudo port install libmpc
sudo port install gmp
sudo pip3 install --global-option=build_ext --global-option="-I/opt/local/include/" --global-option="-L/opt/local/lib/" gmpy2
Note that sudo port install libmpc
automatically installs mpfr
as a dependency. --global-option="-I/opt/local/include/"
basically tells the system that the header files for gmp
, mpc
and mpfr
are in /opt/local/include/
and --global-option="-L/opt/local/lib/"
tells that the libraries to use are located in /opt/local/lib/
.
注意,sudo端口安装libmpc会自动将mpfr作为一个依赖项安装。-global-option="-I/opt/local/include/"基本上告诉系统,gmp、mpc和mpfr的头文件在/opt/local/include/ and -global-option="-L/opt/local/lib/"中,表示要使用的库位于/opt/local/lib/中。
#1
4
I'm the maintainer for gmpy2. I don't have access to a Mac so I can't test OSX builds.
我是gmpy2的维护者。我无法访问Mac,所以无法测试OSX的构建。
I assume you've also installed mpfr
since it is a prerequisite of mpc
. Where are the development files (i.e. gmp.h
, mpfr.h
, and mpc.h
) located?
我假设您也安装了mpfr,因为它是mpc的先决条件。开发文件(即gmp)在哪里?h,mpfr。h,mpc.h)?
Instead of installing via pip, can you try installing from the command line? I use a command similar to:
您可以尝试从命令行安装,而不是通过pip进行安装吗?我使用的命令类似于:
python setup.py install --prefix=/opt/local --force
python的设置。py安装——prefix = / opt /当地——力量
This command assumes that the .h
files are located in /opt/local/include. You will need to adjust the prefix to suit your system.
此命令假定.h文件位于/opt/local/include中。您将需要调整前缀以适应您的系统。
#2
31
For OSX with homebrew users - I tried to do the usual dance with
对于有家酿啤酒用户的OSX,我试着和他们一起跳。
brew install mpc
brew install mpfr
and then
然后
python setup.py --prefix=/usr/local/Cellar
but got the error, that 'mpc.h' could not be found. True enough, there is no mpc.h file to be found. The solution is, to use
但是有个错误,就是mpc。找不到h。确实,没有mpc。h文件有待查找。解决办法是,使用
brew install libmpc
brew install mpfr
instead. After that gmpy2 was compiling and installing with no further problems.
代替。之后,gmpy2正在编译和安装,没有进一步的问题。
#3
9
The short and sweet 2015 answer:
2015年短暂而甜蜜的回答:
brew install mpfr
brew install libmpc
pip install gmpy2
#4
0
As of the 06 March 2018, the only thing that worked for me was the following. (Install on Mac OS High Sierra 10.13.3, for python 3.5.4)
到2018年3月06日为止,对我起作用的只有以下几点。(安装在Mac OS High Sierra 10.13.3,适用于python 3.5.4)
sudo port install libmpc
sudo port install gmp
sudo pip3 install --global-option=build_ext --global-option="-I/opt/local/include/" --global-option="-L/opt/local/lib/" gmpy2
Note that sudo port install libmpc
automatically installs mpfr
as a dependency. --global-option="-I/opt/local/include/"
basically tells the system that the header files for gmp
, mpc
and mpfr
are in /opt/local/include/
and --global-option="-L/opt/local/lib/"
tells that the libraries to use are located in /opt/local/lib/
.
注意,sudo端口安装libmpc会自动将mpfr作为一个依赖项安装。-global-option="-I/opt/local/include/"基本上告诉系统,gmp、mpc和mpfr的头文件在/opt/local/include/ and -global-option="-L/opt/local/lib/"中,表示要使用的库位于/opt/local/lib/中。