How to install Pip on compiled from source Python

12,292

I was facing the same issue. I resolved it by appending an extra parameter to the configure command --with-ensurepip=install followed by make and make install. Then, my installation folder for python has pip there in.

Share:
12,292
CESCO
Author by

CESCO

Jesus Christ ain't Lord

Updated on June 06, 2022

Comments

  • CESCO
    CESCO almost 2 years

    I'm on a raspberry pi running the latest Debian. It comes with 2.7.3 by default but I bought it to run a large Flask home automation app which was all written on 2.7.9 and I want no problems later on ( I know it is a minor version but I am a perfectionist).

    So I downloaded the latest Python 2.7.10. And did

    ./configure && make && make altinstall
    

    So far so good. It has installed the interpreter under /usr/local/bin as I expected. Now I need to to be able to run pip install -r requirements.txt, then I need pip. So I downloaded the get-pip.py from the Python website and tried

    /usr/local/bin/Python2.7 get-pip.py
    

    With no luck. I have also tried to create a virtualenv with a different my compiled Python interpreter like

    virtualenv -p /usr/local/Python2.7 venv
    

    No luck either. I was able to install easy_install on my compiled Python but it also throws me an error when I try

    /usr/local/bin/easy_install pip
    

    What am I doing wrong? I have read about --ensurepip flag for configuring Python at the first place, but Do I need to remove Python and install it all over again just to have pip on my compiled interpreter?