My CentOS 6.5 machine already had Python 2.6 installed in it. Now I just installed Python 2.7. But now, pip is not working. Whenever I run any pip command, it shows following error-

File "/usr/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/lib/python2.6/site-packages/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 92
    _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}
SyntaxError: invalid syntax

I am not understanding what the actual problem is.

  • 1
    Which pip are you using? You need to specify the version, ie. pip3.7. Also, why are you using 2.6? Or even 2.7?
    – slybloty
    Commented Mar 22, 2019 at 13:26
  • Funny thing: even running pip --version command returns same error. And I know it's embarrassing to use older Python versions, but you know I have to, and it's not in my hands :D Commented Mar 22, 2019 at 13:35
  • which pip should tell you what it's trying to do. It appears to me that it's attempting to run 2.7 using 2.6 code. Also check your aliases. On top of that, my recommendation is to move away from 2.6.
    – slybloty
    Commented Mar 22, 2019 at 13:39

1 Answer 1


I had exactly the same issue on a CentOS 6 machine. For me an reinstall worked:

sudo yum remove python-pip
sudo yum install python-pip

then I was able to verify that it work via:

python --version
Python 2.6.6

pip --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .