Installing pip on windows
Quite often Python projects recommend the use of pip for installation. For example tinkerer recommends that you install using:
pip install tinkerer
The problem is that pip and it’s dependency distribute aren’t supplied with the default Python install on windows. Additionally a simple there isn’t a convenient windows equivalent of:
sudo apt-get install python-pip
It took some figuring out how to get hold of pip and its dependencies on a windows machine. I’ve listed the steps required below.
Steps
I’ve got Python 2.7 installed, however these instructions should work for later versions. Please note that certain output and paths will be specific to my installation.
Check your Python installation:
Obviously for this to work you will need to have Python installed, additionally you will need to have both Python C:\Python27 and the Python scripts C:\Python27\Scripts included on the system path.
Start a new console (Start->Run->"cmd.exe"). Now you can check your Python installation by running:
python
You should see something like this:
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
Exit the Python interpreter:
>>> exit()
Install distribute:
You will need to download the following Python script: distribute_setup.py. Now run:
python distribute_setup.py
Install pip:
You will need to download the following Python script: get-pip.py. Now run:
python get_pip.py
What next
If the steps above complete successfully you should be able to use pip to install Python projects. You may want to install virtualenv in order to manage dependencies for individual projects. With virtualenv you gain the ability to have a Python environment local to your project. You can install it using pip:
pip install virtualenv