寫在前面的話
最近在看"Computer Vision with Python"需要安裝PIL庫,平時一直在windows下開發,就去"Python Extensions for Windows"下找找看,結果下下來文件的拓展名是.whl。Google了一番才知道安裝這種拓展名的包需要pip。平時習慣用.exe安裝包,easy_install、pip都沒裝。扒拉點資料,整理下easy_install的安裝方法。有一鍵安裝腳本!
安裝easy_install
- 下載ez_setup.py
from urllib import urlopen
data = urlopen('http://peak.telecommunity.com/dist/ez_setup.py')
with open('ez_setup.py', 'wb') as f:
f.write(data.read())
-
在命令行中運行ez.setup.py

-
一鍵腳本
import os
file_name = 'ez_setup.py'
from urllib import urlopen
data = urlopen('http://peak.telecommunity.com/dist/ez_setup.py')
with open(file_name, 'wb') as f:
f.write(data.read())
os.system('python %s' % (os.path.join(os.getcwd(),file_name)))
安裝pip
easy_install pip

安裝whl文件
pip install whatever.whl

