主页

索引

模块索引

搜索页面

pipx

简介

  • pipx is a tool to help you install and run end-user applications written in Python. It’s roughly similar to macOS’s brew, JavaScript’s npx, and Linux’s apt.

  • It’s closely related to pip. In fact, it uses pip, but is focused on installing and managing Python packages that can be run from the command line directly as applications.

  • [How is it Different from pip?] -> pip is a general-purpose package installer for both libraries and apps with no environment isolation. pipx is made specifically for application installation, as it adds isolation yet still makes the apps available in your shell: pipx creates an isolated environment for each application and its associated packages.

警告

It is not recommended to install pipx via pipx. If you’d like to do this anyway, take a look at the pipx-in-pipx project and read about the limitations there.

安装

brew install pipx

// Ubuntu 23.04 or above
sudo apt install pipx

// Ubuntu 22.04 or below
python3 -m pip install --user pipx


// windows
scoop install pipx

使用

https://img.zhaoweiguo.com/uPic/2024/01/pipx_demo.gif

代码:

>> pipx install pycowsay
  installed package pycowsay 2.0.3, Python 3.7.3
  These apps are now globally available
    - pycowsay
done! ✨ 🌟 ✨


>> pipx list
venvs are in /home/user/.local/share/pipx/venvs
apps are exposed on your $PATH at /home/user/.local/bin
   package pycowsay 2.0.3, Python 3.7.3
    - pycowsay


# Now you can run pycowsay from anywhere
>> pycowsay mooo
  ____
< mooo >
  ====
         \
          \
            ^__^
            (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

命令 pipx run APP [ARGS...]

// Notice that you don't need to execute any install commands to run the app.
> pipx run pycowsay moo

  ---
< moo >
  ---
   \   ^__^
    \  (oo)\_______
       (__)\       )\/\
           ||----w |
           ||     ||

主页

索引

模块索引

搜索页面