HTTPSHandler error while installing pip with python 2.7.9

10,602

Make sure you have openssl and openssl-devel installed before you build Python 2.7

 yum install openssl openssl-devel

or

apt-get install openssl openssl-devel

or (for Debian):

apt-get install libssl-dev

To rebuild Python

cd ~
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar xzf Python-2.7.9.tgz
cd Python-2.7.9
./configure
make install

Then the python get-pip.py should work.

Share:
10,602
R Dha
Author by

R Dha

Updated on July 25, 2022

Comments

  • R Dha
    R Dha over 1 year

    Hi I am trying to install pip with python 2.7.9 but keep getting following error. I want to create python virtual env.

     python get-pip.py
    
            Traceback (most recent call last):
              File "get-pip.py", line 17767, in <module>
                main()
              File "get-pip.py", line 162, in main
                bootstrap(tmpdir=tmpdir)
              File "get-pip.py", line 82, in bootstrap
                import pip
              File "/tmp/tmp_Tfw2V/pip.zip/pip/__init__.py", line 15, in <module>
              File "/tmp/tmp_Tfw2V/pip.zip/pip/vcs/subversion.py", line 9, in <module>
              File "/tmp/tmp_Tfw2V/pip.zip/pip/index.py", line 30, in <module>
              File "/tmp/tmp_Tfw2V/pip.zip/pip/wheel.py", line 35, in <module>
              File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/scripts.py", line 14, in <module>
              File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module>
    
       ImportError: cannot import name HTTPSHandler
    

    I guess this is something related to openssl libraries. Since i don't have sudo access I would like to install it in home folder from source. Any idea how to do it?