# pipx

在隔离环境中安装和运行Python应用程序

cy解释:pipx可以将应用程序安装在虚拟环境中,但是又不用像conda那样切换虚拟环境,就可以在全局命令行中使用。 比如poetry使用pipx安装后,就可以在命令行中直接使用poetry命令

官网 (opens new window)

# 安装

在windows安装Python一般就会安装pipx,在python安装目录下的Script文件夹中

其他系统安装方式见

pipx安装 (opens new window)

# 命令

使用 pipx --help 查看所有命令

官方文档 (opens new window)

(langchain-self-study) E:\python_workspace\python_study>pipx --help
usage: pipx [-h] [--quiet] [--verbose] [--version]
            {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions}
            ...

Install and execute apps from Python packages.

Binaries can either be installed globally into isolated Virtual Environments
or run directly in a temporary Virtual Environment.

Virtual Environment location is C:\Users\cheng\pipx\venvs.
Symlinks to apps are placed in C:\Users\cheng\.local\bin.
Symlinks to manual pages are placed in C:\Users\cheng\.local\share\man.

optional environment variables:
  PIPX_HOME             Overrides default pipx location. Virtual Environments will be installed to $PIPX_HOME/venvs.
  PIPX_BIN_DIR          Overrides location of app installations. Apps are symlinked or copied here.
  PIPX_MAN_DIR          Overrides location of manual pages installations. Manual pages are symlinked or copied here.
  PIPX_DEFAULT_PYTHON   Overrides default python used for commands.
  USE_EMOJI             Overrides emoji behavior. Default value varies based on platform.

options:
  -h, --help            show this help message and exit
  --quiet, -q           Give less output. May be used multiple times corresponding to the ERROR and CRITICAL logging
                        levels. The count maxes out at 2.
  --verbose, -v         Give more output. May be used multiple times corresponding to the INFO, DEBUG and NOTSET
                        logging levels. The count maxes out at 3.
  --version             Print version and exit

subcommands:
  Get help for commands with pipx COMMAND --help

  {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions}
    install             Install a package
    install-all         Install all packages
    uninject            Uninstall injected packages from an existing Virtual Environment
    inject              Install packages into an existing Virtual Environment
    upgrade             Upgrade a package
    upgrade-all         Upgrade all packages. Runs `pip install -U <pkgname>` for each package.
    upgrade-shared      Upgrade shared libraries.
    uninstall           Uninstall a package
    uninstall-all       Uninstall all packages
    reinstall           Reinstall a package
    reinstall-all       Reinstall all packages
    list                List installed packages
    interpreter         Interact with interpreters managed by pipx
    run                 Download the latest version of a package to a temporary virtual environment, then run an app
                        from it. Also compatible with local `__pypackages__` directory (experimental).
    runpip              Run pip in an existing pipx-managed Virtual Environment
    ensurepath          Ensure directories necessary for pipx operation are in your PATH environment variable.
    environment         Print a list of environment variables and paths used by pipx.
    completions         Print instructions on enabling shell completions for pipx

Virtual Environment location is C:\Users\cheng\pipx\venvs. 表示安装程序的虚拟环境所在目录

Last Updated: 11/29/2024, 11:16:39 AM