为什么“pip show”或“pip list”不适合我?

2024-04-29 14:59:03 发布

您现在位置:Python中文网/ 问答频道 /正文

Python的pip正在为我安装和更新软件包而工作,但是一些文档化的命令似乎不受支持(至少在运行OS 10.8.2和Python 2.7.2的1.2.1中是这样)。当我试着

pip list

或者

pip show <pkgname>

我明白了

Usage: pip COMMAND [OPTIONS]
No command by the name pip <cmd>
  (maybe you meant "pip install <cmd>")

这些命令是否尚未实现(尽管有文档记录)?


Tags: piptheno文档命令cmdbyos
3条回答

它们记录在哪里?我的没有显示任何这样的命令:

hd1 % pip help
Usage: pip COMMAND [OPTIONS]
 --version                    show program's version number and exit
 -h, --help                   Show help
 -v, --verbose                Give more output
 -q, --quiet                  Give less output
 --log <FILENAME>             Log file where a complete (maximum verbosity) record will be kept
 --proxy <PROXY>              Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy. If you provide
                              user@proxy.server:port then you will be prompted for a password.
 --timeout <SECONDS>          Set the socket timeout (default 15 seconds)
 --exists-action <EXISTS_ACTION>
                              Default action when a path already exists. Use this option more than one time to specify another action if a certain option is not available. Choices: (s)witch, (i)gnore,
                              (w)ipe, (b)ackup

Commands available:
  bundle: Create pybundles (archives containing multiple packages)
  freeze: Output all currently installed packages (exact versions) to stdout
  help: Show available commands
  install: Install packages
  search: Search PyPI
  uninstall: Uninstall packages
  unzip: Unzip individual packages
  zip: Zip individual packages

您正在寻找的新函数是最近才有的——它们在1.2.1.post1中,但在1.2.1中没有,您可能正在查看的文档(http://www.pip-installer.org/en/latest/)当前是1.2.1.post1。

localhost-2:~ $ pip --version
pip 1.2.1.post1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1.post1-py2.7.egg (python 2.7)
localhost-2:~ $ pip --help
Usage: pip COMMAND [OPTIONS]

Commands:
  bundle               Create pybundles (archives containing multiple packages)
  freeze               Output all currently installed packages (exact versions) to stdout
  help                 Show available commands
  install              Install packages
  list                 List installed packages (including editables).
  search               Search PyPI
  show                 Output installed distributions (exact versions, files) to stdout
  uninstall            Uninstall packages
  unzip                Unzip individual packages
  zip                  Zip individual packages

如果需要,可以获取开发版本:

git clone https://github.com/pypa/pip.git

从pip 1.1开始,可用的命令有:

  • bundle:创建pybundles(包含多个包的存档)
  • 冻结:将当前安装的所有软件包(精确版本)输出到stdout
  • 帮助:显示可用命令
  • 安装:安装软件包
  • 搜索:搜索PyPI
  • 卸载:卸载程序包
  • 解压缩:解压缩单个包
  • zip:压缩单个包

要获得已安装软件包的列表,请尝试yolk

相关问题 更多 >