【Linux】ubuntu使用aptitude命令替换apt-get
程序员文章站
2022-05-29 10:01:39
...
对于Ubuntu 命令行下运行哪个命令进行软件包的安装?对于大部分开发者第一反应是: apt-get
但实际使用过程中,会遇到不知道所需要安装包的正确名称,导致安装失败,如下例子:
Ubuntu下进行相关packet安装的命令是pip, 大家第一反应是直接运行sudo apt-get install pip进行安装,
➜ test sudo apt-get install pip
[sudo] password for t:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pip
???怎么找不到pip? 这时候你可能会通过搜索引擎进行查询, 但这样效率并不高.
实际上Ubuntu还提供了更好用的命令行安装软件的工具: aptitude
在成功安装aptitude命令后,可以运行 aptitude search pip 进行pip相关的软件包名称确认,然后找到对应的packet进行安装,
➜ test aptitude search pip | grep pip | grep python
p python-apipkg - namespace control and lazy-import mechanism for Python
p python-django-pipeline - Asset packaging library for Django
p python-django-pipeline-doc - Documentation for Django Pipeline library
p python-jsonpipe - Convert JSON to a UNIX-friendly line-based format
p python-networking-bagpipe - Driver and agent code to use BagPipe implementation (Python 2)
p python-networking-bagpipe-doc - Driver and agent code to use BagPipe implementation (common documentaiton)
i python-pip - Python package installer
i A python-pip-whl - Python package installer
v python2.7-jsonpipe -
p python3-apipkg - namespace control and lazy-import mechanism for Python 3
p python3-django-pipeline - Asset packaging library for Django (Python3 version)
i python3-pip - Python package installer
以上搜索结果,很容易就可以确认,i python-pip - Python package installer使我们所需要的packet,所以运行如下命令进行python-pip的安装.
➜ test sudo aptitude install python-pip
补充说明(aptitude source packet-name -> ubuntu下下载软件包源码):
aptitude 也提供了如下命令:
aptitude 0.8.10
Usage: aptitude [-S fname] [-u|-i]
aptitude [options] <action> ...
download Download the .deb file for a package (apt wrapper).
source Download source package (apt wrapper).
更详细的请通过运行: aptitude -h 命令进行查看.
上一篇: centos - 初始化服务器环境