参考资料:http://blog.youkuaiyun.com/xia7139/article/details/9113433
相信用过python的同学都碰到过利用pip install的时候 发现安装程序找不到该包名的安装包,因为python包名不一定和库名完全相同。那么 如何根据关键词查询包名?
以安装lxml为例:
1. 先用 apt-cache search找到软件的准确名字
apt-cache search lxml
结果:
inkscape - vector-based drawing program
python-lxml - pythonic binding for the libxml2 and libxslt libraries
python-lxml-dbg - pythonic binding for the libxml2 and libxslt libraries (debug extension)
python-lxml-doc - pythonic binding for the libxml2 and libxslt libraries (documentation)
python3-lxml - pythonic binding for the libxml2 and libxslt libraries
python3-lxml-dbg - pythonic binding for the libxml2 and libxslt libraries (debug extension)
xml-core - XML infrastructure and XML catalog file support
python-okasha - trivial WSGI web framework for Python
python-pyquery - jQuery-like library for python
tclxml - Tcl library for XML parsing
2. 然后就可以用apt-cache python-lxml来查看包的依赖等详细信息。
apt-cache search lxml
结果:
inkscape - vector-based drawing program
python-lxml - pythonic binding for the libxml2 and libxslt libraries
python-lxml-dbg - pythonic binding for the libxml2 and libxslt libraries (debug extension)
python-lxml-doc - pythonic binding for the libxml2 and libxslt libraries (documentation)
python3-lxml - pythonic binding for the libxml2 and libxslt libraries
python3-lxml-dbg - pythonic binding for the libxml2 and libxslt libraries (debug extension)
xml-core - XML infrastructure and XML catalog file support
python-okasha - trivial WSGI web framework for Python
python-pyquery - jQuery-like library for python
tclxml - Tcl library for XML parsing
顺便查了一下apt-cache的用法,贴在下面:
apt-cache是一个apt软件包管理工具,它可查询apt的二进制软件包缓存文件。通过它我们可查询软件包的状态信息。 apt-cache show package_name 显示软件的信息,包括版本号,安装状态和包依赖关系等。 apt-cache search package_name 搜索软件包,可用正则表达式。 apt-cache showpkg package_name 显示软件包的依赖关系信息。 apt-cache policy package_name 显示软件包的安装状态和版本信息。 apt-cache
depends package_name 显示指定软件包所依赖的软件包。
apt-cache rdepends package_name显示软件包的反向依赖关系,即有什么软件包需依赖你所指定的软件包。