unable to install pip for python 2.4.3?

1.3k views Asked by At

Currently I am using Windows 7 and Python 2.4.3. Whenever I try to install pip using the get-pip.py it gives me the following error. Can anyone tell me how to resolve it?

C:\Users\nnkashyap\Downloads>python get-pip.py
  File "get-pip.py", line 43
    _b85alphabet = (b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                                          ^
SyntaxError: invalid syntax

C:\Users\nnkashyap\Downloads>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
2

There are 2 answers

8
M.K On BEST ANSWER

Make sure you got this well, as it is in the documentation:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

It looks like a corruption problem to me. If that does not work, try this:

Install https://chocolatey.org/ which will handle most pip things for you. It is really easy to install.

You can then type choco install pip in a command window. You can also use it for anaconda, python itself, and many other things.

I usually install anaconda first thing instead of "pythong" itself, as the anaconda prompt handles everything else quite well, and for a user without a lot of knowledge, it is quite easy!

0
w0l-g0r On

I ran into the same error while trying to install pip for python 2.4 via the get-pip.py file (on a windows machine). I tried to delete the python2to3 byte code notation 'b' and further replaced the with open() file imports with python 2.4 file=open() statements etc., but finally got stuck during calling main() with an AttributeError: 'module' object has no attribute 'Struct'(seems like the struct module does not have the Struct() attribute in python 2.4 - couldn't call it from the shell neither!).

However, what finally worked for me was the following:

1) If you don't have setuptools installed yet, get the bootstrap script for the setuptools installation from: http://peak.telecommunity.com/dist/ez_setup.py

=> this one https://bitbucket.org/pypa/setuptools/raw/bootstrap-py24/ez_setup.py. from https://pypi.org/project/setuptools/2.0/#python-2-4-and-python-2-5-support did not work for me!

2) If you don't have the SSL module installed yet, you have to manually download the setuptools-0.6c11-py2.4.egg file from https://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg

=> Put the .egg file in the same folder as the ez_setup.py file.

3) With python 2.4 activated, go to the directory with the ez_setup.py file, and run python ez_setup.py within your console. (setuptools-0.6c11-py2.4.egg disappears during the installation process)

4) After having setuptools successfully installed, get pip-1.1 from https://pypi.org/project/pip/1.1/ and unpack it.

5) Go to the pip-1.1 folder and run python setup.py install from console.

P.S.: Don't forget to add the /Scripts folder with the pip.exe to your PATH variable!