install pip for Python 2.6 on OS X

814 ワード

Download the source file here. Then do
$  cd ~/Downloads
$  tar -xzvf pip-7.0.1.tar.gz 

(replacing ~/Downloads if necessary). Then
$ cd pip-7.0.1
$ sudo python2.6 setup.py install
$ cd

(the last cd is used to leave the build directory). Now you should be able to run
$ python2.6 -c 'import pip;print pip.__version__'
 7.0.1

By default, pip (when installed from source) should be installed into/usr/local/bin. To check:
$ /usr/local/bin/pip --version
pip 7.0.1 from /Library/Python/2.6/site-packages/pip-7.0.1-py2.6.egg (python 2.6)

Now you can install your favorite packages using
$ /usr/local/bin/pip install package
$ python2.6 -c 'import package'