在python包管理中使用easy_install軟件的步驟
easy_install讓python包管理變得
如果你想對Python包管理在實際操作過程中的實際應用方案更加的簡便,你就可以試用easy_install這一工具,你如果在python包管理中想用這一軟件,你就可以瀏覽以下的文章。希望你能夠從中獲得更多的知識。
Python中的easy_install工具很好用,它的作用類似于Php中的pear,或者Ruby中的gem,或者Perl中的cpan。如果想使用easy_install工具,可以直接安裝ez_setup.py腳本,再python ez_setup.py(之前先要安裝python):
安裝完后,最好確保easy_install所在目錄已經被加到PATH環(huán)境變量里:
- Windows: C:\Python25\Scripts
- Linux: /usr/local/bin
比如說要安裝Python的MySQL支持,可以執(zhí)行如下命令,系統(tǒng)會自動在pypi網站列表里查找相關軟件包,并選擇合適的版本:
- easy_install MySQL-python
通過easy_install安裝軟件,相關安裝信息會保存到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的相關信息抹去,剩下的egg文件,你可以手動刪除。對于已經下載了的python包,easy_install也可以安裝,只要進入軟件包目錄,然后“easy_install .”即可更多使用方法參見peak上的介紹,
使用easy_install安裝python環(huán)境:#t#
1、下載python2.5安裝文件安裝(最新的穩(wěn)定版,不要嘗試 python2.6或3.0,因為許多py包還不支持)
2、下載pyreadline可執(zhí)行文件安裝
3、下載ez_install.py運行
4、easy_install ipython ipy pylint django robotframework mechanize
5、不能使用easy_install的特殊情況:
a、安裝默認版本的MySQL-python會報錯,需要指定版本如下:
- easy_install "MySQL-python==1.2.2"
b、有些包直接easy_install會失敗,需要自行下載安裝:wxpython,pil要下載exe安裝程序robotide因為在pypi上找不到,要下載后再easy_install