pip is an incredibly handy package manager for Python. As of Python 3.4, it is included with default distributions of Python.1 Once you are used to using it, you will miss having it when stuck working with older versions.
Fortunately, pip can be installed to pre-3.4 versions of Python in a few simple steps. Oddly enough, though the process is simple, a complete solution wasn't easily available (via very quick Googling, anyway) so I'll write the process here.
For the steps below, assume a Windows platform with the following structure:
C:\ Python32\ python32.exe Python33\ python33.exe Python34\ python.exe Scripts\ pip.exe pip3.exe pip3.4.exe
The above tree is incomplete of course; only relevant portions are included.
C:\PythonXX directory is on the system PATH, so the older version executables have been renamed to not conflict with each other, e.g.
Python32\python.exe was renamed
Python32\python32.exe. In this setup, executing
python is intended to always default to the latest version installed.
Given this setup, assume you want to install pip to Python 3.3.
Navigate to the directory of
python33 get_pip.py. The version of Python used to run the script must be the one to which you want pip installed.
get_pipshould successfully execute (it may install e.g. setuptools as well, but this happens automatically), and have placed
pip3.3.exe, and some more files in
C:\Python33\Scripts. Note the versioned executable, in this case
pip3.3.exe, is helpful to specify for which version of Python you want to run pip.
C:\Python33\Scripts\;to the system PATH (don't forget the trailing semicolon). There are plenty of guides out there for how to do this. Here is one for Windows 7/8.
There may now be multiple versions of
pip.exeon the path, thus executing
pipmay not default to the version of Python desired. You can check which is used with
pip --version. If you want
pipto default to e.g. the latest Python, delete
C:\Python33\Scripts\pip.exeand use the versioned executables (e.g.
pip3.3) for older versions. You may have to restart the command prompt/terminal for these changes to take effect.
Now it should be possible to run
pip3.3 install [some package]and install a package to Python 3.3.
After the steps above, the sample layout from the "Assumptions" section should now look like this:
C:\ Python32\ python32.exe Python33\ python33.exe Scripts\ pip3.3.exe Python34\ python.exe Scripts\ pip.exe pip3.4.exe
pip is also included by default in Python 2.7.9 and beyond in the Python2 series. ↩