操作系统: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