linux下安裝easy_install的方法
如果想使用easy_install工具,可能需要先安裝setuptools,不過更酷的方法是使用ez_setup.py腳本:
wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
安裝完后,最好確保easy_install所在目錄已經(jīng)被加到PATH環(huán)境變量里:
Windows: C:\Python25\Scripts
Linux: /usr/local/bin
比如說要安裝Python的MySQL支持,可以執(zhí)行如下命令,系統(tǒng)會自動在pypi網(wǎng)站列表里查找相關(guān)軟件包:
easy_install MySQL-python
如果你在Windows+python2.5上執(zhí)行如上命令的話,可能會出現(xiàn)如下錯誤:
Processing MySQL-python-1.2.3c1.tar.gz
Running MySQL-python-1.2.3c1\setup.py -q bdist_egg --dist-dir c:\docume~1\...
\locals~1\temp\easy_install-fvvfve\MySQL-python-1.2.3c1\egg-dist-tmp-q9moxf
error: The system cannot find the file specified
出現(xiàn)這類錯誤的原因是選錯了版本,針對這個案列,我們可以顯式指定軟件包的版本號:
easy_install "MySQL-python==1.2.2"
通過easy_install安裝軟件,相關(guān)安裝信息會保存到easy-install.pth文件里,路徑類似如下形式:
Windows:C:\Python25\Lib\site-packages\easy-install.pth
Linux:/usr/local/lib/python25/site-packages/easy-install.pth
如果想刪除通過easy_install安裝的軟件包,比如說:MySQL-python,可以執(zhí)行命令:
easy_install -m MySQL-python
此操作會從easy-install.pth文件里把MySQL-python的相關(guān)信息抹去,剩下的egg文件,手動刪除即可。