issue206:python
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| issue206:python [2024/06/29 16:31] – créée auntiee | issue206:python [2024/07/02 11:27] (Version actuelle) – auntiee | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | pipx??? | + | **pipx??? |
| Greetings again fellow Sentient Lifeforms and, as Dr. Johnny Fever would say, “Fellow Babies”. Once again, I’m beaming from landing pad 2997 on Terra to bring you more information on Python and its related goodies, add-ons, tips, tricks, traps, and other weirdness. | Greetings again fellow Sentient Lifeforms and, as Dr. Johnny Fever would say, “Fellow Babies”. Once again, I’m beaming from landing pad 2997 on Terra to bring you more information on Python and its related goodies, add-ons, tips, tricks, traps, and other weirdness. | ||
| Ligne 9: | Ligne 9: | ||
| So let’s open a browser and look at https:// | So let’s open a browser and look at https:// | ||
| - | 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' |
| - | 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.” | + | pipx ??? |
| - | In fact, if you dig deeper, you will find this statement: | + | 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' |
| + | |||
| + | 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 30: | Ligne 43: | ||
| If, however, you want to install via pip(3)... | If, however, you want to install via pip(3)... | ||
| + | |||
| + | 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 | pip install pipx | ||
| - | You might want to run the last two lines from the apt install section above, after you've installed via pip – to make sure pipx is available from pretty much anywhere on your system. | + | |
| + | **You might want to run the last two lines from the apt install section above, after you've installed via pip – to make sure pipx is available from pretty much anywhere on your system. | ||
| pipx ensurepath | pipx ensurepath | ||
| Ligne 52: | Ligne 88: | ||
| {install, | {install, | ||
| ... | ... | ||
| + | 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. | 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). | ||
| And it keeps going, so I’m going to just leave it at this. The important commands (at least for me) are list, install, and uninstall. | And it keeps going, so I’m going to just leave it at this. The important commands (at least for me) are list, install, and uninstall. | ||
| Ligne 64: | 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 150: | ||
| | | ||
| - pycowsay | - pycowsay | ||
| + | - | ||
| - | Now, we can run the pycowsay program without calling Python directly or even using the .py extension. | ||
| - | greg@Earth2: | + | **Now, we can run the pycowsay |
| + | greg@Earth2: | ||
| + | < | ||
| | | ||
| < Howdy fellow beings! | < Howdy fellow beings! | ||
| Ligne 86: | Ligne 164: | ||
| | | ||
| | | ||
| - | | + | |
| greg@Earth2: | greg@Earth2: | ||
| Ligne 96: | Ligne 174: | ||
| greg@Earth2: | greg@Earth2: | ||
| - | 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 107: | 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 115: | Ligne 217: | ||
| You can see that there are four different applications that seem to be associated with the name “esptool”. | You can see that there are four different applications that seem to be associated with the name “esptool”. | ||
| - | 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.** |
| - | greg@Earth2: | + | 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' | ||
| + | |||
| + | |||
| + | **greg@Earth2: | ||
| esptool.py is already on your PATH and installed at / | esptool.py is already on your PATH and installed at / | ||
| 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 127: | Ligne 248: | ||
| Again, their website is https:// | Again, their website is https:// | ||
| - | 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.1719671506.txt.gz · Dernière modification : 2024/06/29 16:31 de auntiee
