Python - pipx 无法将“pipx”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。

操作系统:Window 10 x64

根据 Installing stand alone command line tools 安装 pipx,重启 Powershell。但是,当我想查看 pipx 的帮助信息时,出现:

PS C:\Users\Admin> pipx --help
pipx : 无法将“pipx”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正
确,然后再试一次。
所在位置 行:1 字符: 1
+ pipx --help
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (pipx:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

后来发现,是因为没有将 Python 添加到环境变量中。

不过,奇怪的是,在此之前,我可以在 Powershell 或 cmd 中调用 Python。

将 Python 添加环境变量中即可:

在这里插入图片描述

重新打开 Powershell 输入 pipx --help 命令:

PS C:\Users\Admin> pipx --help
usage: pipx [-h] [--version]
            {install,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,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\Admin\.local\pipx\venvs.
Symlinks to apps are placed in C:\Users\Admin\.local\bin.

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.
  USE_EMOJI             Overrides emoji behavior. Default value varies based on platform.
  PIPX_DEFAULT_PYTHON   Overrides default python used for commands.

options:
  -h, --help            show this help message and exit
  --version             Print version and exit

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

  {install,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,completions}
    install             Install a package
    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.
    uninstall           Uninstall a package
    uninstall-all       Uninstall all packages
    reinstall           Reinstall a package
    reinstall-all       Reinstall all packages
    list                List installed packages
    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.
    completions         Print instructions on enabling shell completions for pipx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值