linux下安装easy_install的方法

时间:2022-07-20 15:10:24 

如果想使用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文件,手动删除即可。

标签:easy,install
0
投稿

猜你喜欢

  • python中子类继承父类的__init__方法实例

    2022-05-27 19:37:21
  • pytorch1.0中torch.nn.Conv2d用法详解

    2023-07-17 10:53:48
  • NumPy统计函数的实现方法

    2021-10-15 22:02:27
  • 一文详解Python中复合语句的用法

    2021-08-11 23:15:40
  • ASP中遍历和操作Application对象的集合

    2007-09-13 12:45:00
  • 兼容主流浏览器,纯CSS下拉菜单

    2010-09-05 20:30:00
  • python实现输出一个序列的所有子序列示例

    2022-04-13 18:34:45
  • Django框架基础认证模块auth应用示例

    2023-11-10 07:48:51
  • 用滤镜使网页图片产生旋转效果

    2007-11-03 11:36:00
  • 重新认识ASP之后的我在想"是时候改变了"

    2008-05-08 13:10:00
  • Python对象的属性访问过程详解

    2023-09-02 13:40:04
  • python 列表降维的实例讲解

    2023-08-28 16:44:54
  • Python3.10.4激活venv环境失败解决方法

    2022-11-15 10:39:39
  • Python字典遍历的陷阱

    2022-11-16 21:59:11
  • Python Panda中索引和选择 series 的数据

    2023-05-03 10:02:56
  • Python yield的用法实例分析

    2022-08-03 10:00:21
  • 从JavaScript的函数重名看其初始化方式

    2023-07-16 22:00:12
  • Python自动化测试Eclipse+Pydev 搭建开发环境

    2022-07-15 07:01:54
  • Python Decorator装饰器的创建方法及常用场景分析

    2022-05-05 03:34:11
  • Python3.4学习笔记之常用操作符,条件分支和循环用法示例

    2021-08-24 03:06:43
  • asp之家 网络编程 m.aspxhome.com