Search code examples
pythonpipeasy-installcentos5python-2.4

PIP raising SyntaxError from command line


I have attempted to install PIP using the following commands:

sudo yum install python-setuptools
sudo easy_install pip
sudo pip install supervisor

As it installed, a number of syntax errors were raised from the second and third lines. The errors are fairly similar to that below, so for brevity I'll omit here, but let me know if having those will help. There are a lot.

When I run any pip command, I get SyntaxErrors:

# pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 7, in ?
    sys.exit(
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 236, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2097, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1830, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.4/site-packages/pip-8.1.1-py2.4.egg/pip/__init__.py", line 208
    except PipError as exc:
                     ^
SyntaxError: invalid syntax

I am running CentOS release 5.11 (Final) and Python 2.4.3 (#1, Jan 9 2013, 06:47:03). Note, these are managed by WHM.

I have re-installed PIP using python get-pip.py --ignore-installed, but get the same result.

Is this a Python version conflict? Is my version of Python too old and the syntax in the PIP scripts different? What should I do?


Solution

  • except PipError as exc: isn't a valid Python 2.4 syntax (it should be except PipError, exc).

    I don't think pip is meant to work with Python 2.4. Try this question for installing PIP 1.1, which is compatible with that version of Python:

    Installing Pip on 2.4