Warum gibt Pip einen Fehler aus, wenn Numpy in Termux installiert wird?

Warum gibt Pip einen Fehler aus, wenn Numpy in Termux installiert wird?

Ich installiere Numpy in Termux. Beim Ausführen pip install numpy --no-cache-dirlautete der Fehler:

File "/data/data/com.termux/files/usr/tmp/pip-install-ywfqxfk8/numpy_cf9d5c136bf14c7f9ce4181f190e4581/numpy/core/setup.py", line 171, in check_math_capabilities
          raise SystemError("One of the required function to build numpy is not"
      SystemError: One of the required function to build numpy is not available (the list is ['sin', 'cos', 'tan', 'sinh', 'cosh', 'tanh', 'fabs', 'floor', 'ceil', 'sqrt', 'log10', 'log', 'exp', 'asin', 'acos', 'atan', 'fmod', 'modf', 'frexp', 'ldexp']).

Es gibt eine vollständige Ausgabe:https://pastebin.com/ExnbqtDc. Warum passiert das und wie kann man es beheben?


Die Pakete Wheel und Setuptools sind installiert.

Antwort1

Verwenden:

MATHLIB="m" pip3 install numpy

Antwort2

Ich weiß nicht warum, aber das hier funktioniert auch und scheint für Termux viel schneller zu sein:

LDFLAGS="-lm -lcompiler_rt" pip install cython numpy

Antwort3

Ergänzung zu xuziyues Antwort:

Kurzfassung:

Sie müssen eine Numpy-Version installieren, die mit Ihrer Python-Installation kompatibel ist. Überprüfen SieHier.


Längere Version:

Zunächst habe ich einfach Folgendes ausgeführt:

MATHLIB="m" pip install numpy

Dies hat Numpy erfolgreich installiert, aber ichviele Fehler später beim Importierenes in meinen Code.

ABERAusführen python --versionund anschließendes PrüfenTisch, und versuchen Sie dann:

MATHLIB="m" pip install numpy==1.24

Dadurch funktionierte tatsächlich alles wie erwartet.


Zu Ihrer Information, ich verwende dies jetzt auf Android:

  • Termux 0.118.0
  • Python 3.10.4
  • Numpy 1.24

Hoffe das hilft.

verwandte Informationen