Skip to content Skip to sidebar Skip to footer

Pip Install Errors Out: SyntaxError: Invalid Syntax

pip install does not work when trying to install virtualenv, requests or pex on CentOS6. I am on python2.6 and pip 9.0.1. Can anyone tell me why is this happening? (pex_build)[root

Solution 1:

The problem is your version of pip is broken with Python 2.6. If you upgrade to 9.0.3 it should work again.

pip install pip==9.0.3

If you are unable to upgrade pip using pip, you could re-install the package as well using your local package manager, and then upgrade to pip 9.0.3.

Keep in mind that if you are using virtual environments it is recommended that you upgrade virtualenv as well so that your virtual environments will have pip 9.0.3 as well.

pip install virtualenv==15.2.0

Be careful though to not upgrade to a version of pip higher than 9.0.3 or virtualenv higher than 15.2.0 as Python 2.6 support was removed with those versions, as mentioned by Prateek.


Solution 2:

pip works with CPython versions 2.7, 3.3, 3.4, 3.5, 3.6 and also pypy.

This means pip works on the latest patch version of each of these minor versions. Previous patch versions are supported on a best effort approach.

Just use below command one you upgrade to compatible Python version.

pip install requests

check pip-documentation for more details.

Including @eandersson's comments

Or you you can upgrade pip to 9.0.3

pip install pip==9.0.3


Post a Comment for "Pip Install Errors Out: SyntaxError: Invalid Syntax"