Python中的easy_install
2009-06-23 11:34
267 查看
Python中的easy_install工具很爽,它的作用类似于Php中的pear,或者Ruby中的gem,或者Perl中的cpan。
如果想使用easy_install工具,可能需要先安装setuptools,不过更酷的方法是使用ez_setup.py脚本:
wget -q http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py
安装完后,最好确保easy_install所在目录已经被加到PATH环境变量里:
Windows: C:/Python25/Scripts
Linux: /usr/local/bin
比如说要安装Python的MySQL支持,可以执行如下命令,系统会自动在pypi网站列表里查找相关软件包:
easy_install MySQL-python
如果你在Windows+python2.5上执行如上命令的话,可能会出现如下错误:
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
出现这类错误的原因是选错了版本,针对这个案列,我们可以显式指定软件包的版本号:
easy_install "MySQL-python==1.2.2"
通过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,可以执行命令:
easy_install -m MySQL-python
此操作会从easy-install.pth文件里把MySQL-python的相关信息抹去,剩下的egg文件,你可以手动删除。
参考文档:可爱的 Python: 使用 setuptools 孵化 Python egg
如果想使用easy_install工具,可能需要先安装setuptools,不过更酷的方法是使用ez_setup.py脚本:
wget -q http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py
安装完后,最好确保easy_install所在目录已经被加到PATH环境变量里:
Windows: C:/Python25/Scripts
Linux: /usr/local/bin
比如说要安装Python的MySQL支持,可以执行如下命令,系统会自动在pypi网站列表里查找相关软件包:
easy_install MySQL-python
如果你在Windows+python2.5上执行如上命令的话,可能会出现如下错误:
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
出现这类错误的原因是选错了版本,针对这个案列,我们可以显式指定软件包的版本号:
easy_install "MySQL-python==1.2.2"
通过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,可以执行命令:
easy_install -m MySQL-python
此操作会从easy-install.pth文件里把MySQL-python的相关信息抹去,剩下的egg文件,你可以手动删除。
参考文档:可爱的 Python: 使用 setuptools 孵化 Python egg
相关文章推荐
- CentOS 6 安装 python 2.7 (系统自带Python2.6.6) (附easy_install安装, pip安装)
- Python-- easy_install 的安装
- python中easy_install 卸载已经安装的包
- python easy_install安装
- python 安装easy_install和pip
- Python 2.7 安装easy_install 时报错处理方法
- How can I install Easy_Install for Python 2.6.4 in Mac OSX 10.4.11【转】
- 使用easy_install安装python的包
- [python]python的包管理工具:pip和easy_install
- Python easy_install工具安装
- python 基础知识—— easy_install
- linux中python安装easy_install
- Python的包管理工具easy_install, setuptools, pip,distribute介绍
- Windows 下 Python easy_install 的安装
- 使用easy_install安装python第三方模块的方法
- Centos下安装pip,easy_install等python扩展库,centos下的
- win7/64位下python2.7、easy_install、numpy安装经验
- python中easy_install 卸载已经安装的包
- Python install easy_install and pip
- python3.4学习笔记(十六) windows下面安装easy_install和pip教程