安装 fastnumbers 时安装失败

Installation fails when installing fastnumbers

我正在尝试安装依赖于 fastnumbers 3.0.0 的 python 库,但是在尝试安装它时,我得到以下信息:

warnings.warn(
      running build
      running build_ext
      creating build
      creating build/temp.macosx-11-x86_64-3.9
      creating build/temp.macosx-11-x86_64-3.9/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -stdlib=libc++ -I/private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include -I/Users/carlos/ide-mx-decision-fraud/env/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/fastnumbers.c -o build/temp.macosx-11-x86_64-3.9/src/fastnumbers.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -stdlib=libc++ -I/private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include -I/Users/carlos/ide-mx-decision-fraud/env/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/numbers.c -o build/temp.macosx-11-x86_64-3.9/src/numbers.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -stdlib=libc++ -I/private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include -I/Users/carlos/ide-mx-decision-fraud/env/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/objects.c -o build/temp.macosx-11-x86_64-3.9/src/objects.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -stdlib=libc++ -I/private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include -I/Users/carlos/ide-mx-decision-fraud/env/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/parsing.c -o build/temp.macosx-11-x86_64-3.9/src/parsing.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -stdlib=libc++ -I/private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include -I/Users/carlos/ide-mx-decision-fraud/env/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/strings.c -o build/temp.macosx-11-x86_64-3.9/src/strings.o
      src/strings.c:115:20: error: implicit declaration of function '_Py_dg_stdnan' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                  return PyFloat_from_NaN(sign < 0);
                         ^
      /private/var/folders/_d/kht28yq15hjbm17zkr9_zhkh0000gp/T/pip-install-p7m6zg86/fastnumbers_538a0b1c68c844a0a91900d614d59f53/include/fastnumbers/numbers.h:24:55: note: expanded from macro 'PyFloat_from_NaN'
      #define PyFloat_from_NaN(negative) PyFloat_FromDouble(_Py_dg_stdnan(negative));
                                                            ^
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

我正在使用带有 big sur 和 python 3.9 的 mac。

我已经尝试按照其他 question 中所述导出变量,但它没有解决我的问题

这是与 Python 3.9 的兼容性问题。 2020 年 11 月 reported and fixed。升级到 fastnumbers 3.1.0 或 3.2.1。

如果不能升级降级到Python3.8.