issue206:python
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| issue206:python [2024/07/01 08:27] – d52fr | issue206:python [2024/07/02 11:27] (Version actuelle) – auntiee | ||
|---|---|---|---|
| Ligne 11: | Ligne 11: | ||
| According the the web page: “pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS' | According the the web page: “pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS' | ||
| + | pipx ??? | ||
| - | **It's closely related to pip. In fact, it uses pip, but is focused on installing and managing | + | Je vous salue à nouveau, chers formes de vie sensibles et, comme le dirait le Dr Johnny Fever, « chers bébés ». Une fois de plus, je me téléporte depuis la plateforme d' |
| - | In fact, if you dig deeper, you will find this statement: | + | Ce mois-ci, nous allons parler de pipx. Je suis sûr que vous êtes en train de vous dire : « Qu' |
| + | |||
| + | pipx EST RÉEL. pipx, selon leur site Web, vous permet « d' | ||
| + | |||
| + | Ouvrons donc un navigateur et regardons https:// | ||
| + | |||
| + | Selon la page Web : « pipx est un outil qui vous aide à installer et à exécuter des applications écrites en Python pour l' | ||
| + | |||
| + | |||
| + | ** 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. » | ||
| + | |||
| + | In fact, if you dig deeper, you will find this statement: | ||
| Now that makes things much clearer. So how do you install such a thing? | Now that makes things much clearer. So how do you install such a thing? | ||
| Ligne 33: | Ligne 45: | ||
| pip install pipx** | pip install pipx** | ||
| + | |||
| + | Il est étroitement lié à pip. En fait, il utilise pip, mais se concentre sur l' | ||
| + | |||
| + | En fait, si vous creusez un peu plus, vous trouverez cette déclaration : « pipx est un installeur de paquets spécialisé. Il ne peut être utilisé que pour installer des paquets avec des points d' | ||
| + | |||
| + | Voilà qui rend les choses beaucoup plus claires. Alors, comment installer une telle chose ? | ||
| + | |||
| + | Il y a deux façons d' | ||
| + | |||
| + | Nous allons donc commencer par la méthode apt. En supposant que vous utilisiez Ubuntu 23.04 ou une version supérieure (ou une distro basée sur cette dernière) : | ||
| + | |||
| + | sudo apt update | ||
| + | |||
| + | sudo apt install pipx | ||
| + | |||
| + | pipx ensurepath | ||
| + | |||
| + | sudo pipx ensurepath --global # optionnel pour permettre les actions pipx avec l' | ||
| + | |||
| + | Cependant, si vous voulez l' | ||
| + | |||
| + | pip install pipx | ||
| Ligne 55: | Ligne 89: | ||
| ... | ... | ||
| Install and execute apps from Python packages.** | Install and execute apps from Python packages.** | ||
| + | |||
| + | Vous pouvez exécuter les deux dernières lignes de la section apt install ci-dessus, après l' | ||
| + | |||
| + | pipx ensurepath | ||
| + | |||
| + | sudo pipx ensurepath --global # optionnel pour autoriser les actions pipx avec l' | ||
| + | |||
| + | Ok, c'est installé. Et maintenant ? | ||
| + | |||
| + | Nous allons voir quelques options de la ligne de commande pour nous aider. | ||
| + | |||
| + | Si vous ne savez pas quoi faire, vous pouvez toujours demander de l'aide (help) : | ||
| + | |||
| + | pipx -h | ||
| + | |||
| + | ~/Desktop$ pipx -h | ||
| + | usage: pipx [-h] [--version] | ||
| + | |||
| + | {install, | ||
| + | ... | ||
| + | Install and execute apps from Python packages. | ||
| + | |||
| **Actually, I’m breaking the terminal output here to save space (more shown on the next page, top right). | **Actually, I’m breaking the terminal output here to save space (more shown on the next page, top right). | ||
| Ligne 65: | Ligne 121: | ||
| installed package pycowsay 2.0.3, Python 3.10.3 | installed package pycowsay 2.0.3, Python 3.10.3 | ||
| These apps are now globally available | These apps are now globally available | ||
| + | - pycowsay done! | ||
| + | |||
| + | Now that you have something installed, let’s try doing a list. ** | ||
| + | |||
| + | **greg@Earth2: | ||
| + | venvs are in / | ||
| + | apps are exposed on your $PATH at / | ||
| + | | ||
| - pycowsay | - pycowsay | ||
| - | done! | + | - ** |
| + | |||
| + | En fait, j' | ||
| + | |||
| + | Et ça continue, alors je vais m' | ||
| + | |||
| + | Installons donc quelque chose. Nous utiliserons le stupide programme pycowsay comme exemple. | ||
| + | |||
| + | >> pipx install pycowsay | ||
| + | installed package pycowsay 2.0.3, Python 3.10.3 | ||
| + | These apps are now globally available | ||
| + | - pycowsay | ||
| - | Now that you have something installed, let’s try doing a list. | + | Maintenant que vous avez installé quelque chose, essayons de faire une liste. |
| greg@Earth2: | greg@Earth2: | ||
| Ligne 74: | Ligne 149: | ||
| apps are exposed on your $PATH at / | apps are exposed on your $PATH at / | ||
| | | ||
| - | - pycowsay** | + | - pycowsay |
| - | - | ||
| + | |||
| **Now, we can run the pycowsay program without calling Python directly or even using the .py extension. | **Now, we can run the pycowsay program without calling Python directly or even using the .py extension. | ||
| greg@Earth2: | greg@Earth2: | ||
| + | < | ||
| | | ||
| < Howdy fellow beings! | < Howdy fellow beings! | ||
| Ligne 88: | Ligne 164: | ||
| | | ||
| | | ||
| - | | + | |
| greg@Earth2: | greg@Earth2: | ||
| Ligne 100: | Ligne 176: | ||
| Now I’ve already installed pycowsay into pipx, so it will complain at me just a little bit, but will still download and run it.** | Now I’ve already installed pycowsay into pipx, so it will complain at me just a little bit, but will still download and run it.** | ||
| - | **pycowsay | + | Maintenant, nous pouvons exécuter le programme |
| + | greg@Earth2: | ||
| + | < | ||
| + | | ||
| + | < Chers amis ! Heureux de vous revoir ! > | ||
| + | | ||
| + | | ||
| + | \ (oo)\_______ | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | greg@Earth2: | ||
| + | |||
| + | Comme je l'ai dit. C'est un programme idiot. | ||
| + | |||
| + | Une autre caractéristique de pipx est qu'il peut télécharger et exécuter une application dans un environnement virtuel temporaire sans installer l' | ||
| + | |||
| + | greg@Earth2: | ||
| + | |||
| + | J'ai déjà installé pycowsay dans pipx, il va donc se plaindre un peu, mais il va quand même le télécharger et l' | ||
| + | |||
| + | |||
| + | **pycowsay is already on your PATH and installed at / | ||
| + | < | ||
| --- | --- | ||
| < moo > | < moo > | ||
| Ligne 109: | Ligne 209: | ||
| | | ||
| | | ||
| - | | + | |
| What happens if you try to install a program that doesn’t have an entry point, or has a name that doesn’t match the actual filename? The esptool package is a good example of this. I use this package to flash some of the esp microcontrollers that I have. | What happens if you try to install a program that doesn’t have an entry point, or has a name that doesn’t match the actual filename? The esptool package is a good example of this. I use this package to flash some of the esp microcontrollers that I have. | ||
| Ligne 118: | Ligne 218: | ||
| To get around that, we can use the --spec option with the name of the program.** | To get around that, we can use the --spec option with the name of the program.** | ||
| + | |||
| + | pycowsay is already on your PATH and installed at / | ||
| + | < | ||
| + | --- | ||
| + | < moo > | ||
| + | --- | ||
| + | | ||
| + | \ (oo)\_______ | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Que se passe-t-il si vous essayez d' | ||
| + | |||
| + | Tout d' | ||
| + | |||
| + | Vous pouvez voir qu'il y a quatre applications différentes qui semblent être associées au nom « esptool ». | ||
| + | |||
| + | Pour contourner ce problème, nous pouvons utiliser l' | ||
| Ligne 124: | Ligne 243: | ||
| Again, I’ve already got it loaded, but pipx will download the latest version and then run it in a virtual environment for me. There is a LOT of terminal output so I’ll just pick some to show that it really runs (next page, bottom right). | Again, I’ve already got it loaded, but pipx will download the latest version and then run it in a virtual environment for me. There is a LOT of terminal output so I’ll just pick some to show that it really runs (next page, bottom right). | ||
| - | |||
| There are SO many reasons to give pipx a try. | There are SO many reasons to give pipx a try. | ||
| Ligne 132: | Ligne 250: | ||
| Until next time, as always; stay safe, healthy, positive and creative!** | Until next time, as always; stay safe, healthy, positive and creative!** | ||
| + | greg@Earth2: | ||
| + | esptool.py is already on your PATH and installed at / | ||
| + | |||
| + | Encore une fois, je l'ai déjà chargé, mais pipx téléchargera la dernière version et l' | ||
| + | |||
| + | Il y a TANT de raisons d' | ||
| + | |||
| + | Encore une fois, leur site Web est https:// | ||
| + | |||
| + | Jusqu' | ||
| + | |||
| + | |||
| + | //p. 23, encart, lignes en noir : | ||
| + | |||
| + | ** And the terminal output continues…** | ||
| + | Et la sortie sur le terminal se poursuit : | ||
| + | |||
| + | **[EDITOR SNIPPED IT HERE]** | ||
| + | [L' | ||
issue206/python.1719815221.txt.gz · Dernière modification : 2024/07/01 08:27 de d52fr
