[Python] How do install pip/math module from configured python2.7 source

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    Ubuntu 25 (plucky)

    how do I include the math and other modules when compiling from source?

    https://docs.posit.co/resources/install-python-source.html

    Compiling 2.7.4

    Wasn’t able to use deadsnakes:ppa because there was no release for Ubuntu 25/plucky. I would prefer this actually…

    Note that when I run:1st curl -O https://bootstrap.pypa.io/get-pip.py sudo /opt/python/${PYTHON_VERSION}/bin/python${PYTHON_MAJOR} get-pip.py

    It fails because of missing math module:

    scarlet@scarlet:~/Python-2.7.4$ python2 get-pip.py
    Traceback (most recent call last):
    File "get-pip.py", line 28, in <module>
    import tempfile
    File "/usr/local/lib/python2.7/tempfile.py", line 35, in <module>
    from random import Random as _Random
    File "/usr/local/lib/python2.7/random.py", line 45, in <module>
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
    ImportError: No module named math
    scarlet@scarlet:~/Python-2.7.4$


    Compiled from source, tried to figure out how to install ppa, can’t install pip or run my other npm commands that require python2 (old code)..

    Continue reading...

Compartilhe esta Página