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 Mar 22 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 – Sumedh Junghare Mar 22 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 Mar 22 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.