Ligne 8 : |
Ligne 8 : |
| pip install ''Nom_du_paquet'' | | pip install ''Nom_du_paquet'' |
| | | |
− | == upip == | + | == Qu'est ce que UPIP == |
| UPIP est un module particulier de MicroPython qui permet de réaliser la même chose que l'utilitaire PIP. | | UPIP est un module particulier de MicroPython qui permet de réaliser la même chose que l'utilitaire PIP. |
| + | |
| + | UPIP localise le paquet sur [https://pypi.python.org/pypi PiPy] et le télécharge sur la plateforme MicroPython via la connexion WiFi. |
| + | |
| + | [[Fichier:PythonPackageIndex.png|150px]] |
| | | |
| Vous pouvez localiser les paquets destinés à MicroPython sur [https://pypi.python.org/pypi Python Package Index] en faisant une recherche sur "'''micropython-'''". | | Vous pouvez localiser les paquets destinés à MicroPython sur [https://pypi.python.org/pypi Python Package Index] en faisant une recherche sur "'''micropython-'''". |
Ligne 16 : |
Ligne 20 : |
| | | |
| == Utiliser upip == | | == Utiliser upip == |
− | Sur un ESP8266, '''upip''' installe la bibliothèque dans le sous-répertoire {{fname|lib}} de la plateforme MicroPython. | + | Sur un ESP8266 (un ESP32 ou Pyboard avec interface Ethernet ) '''upip''' permet d'installer la bibliothèque dans le sous-répertoire {{fname|lib}} de la plateforme MicroPython. |
| | | |
| Nous allons installer le paquet {{fname|micropython-abc}}, un paquet d'exemple. | | Nous allons installer le paquet {{fname|micropython-abc}}, un paquet d'exemple. |
Ligne 23 : |
Ligne 27 : |
| | | |
| <syntaxhighlight lang="python"> | | <syntaxhighlight lang="python"> |
− | import upip | + | >>> import upip |
− | upip.install( "micropython-abc" ) | + | >>> upip.install( "micropython-abc" ) |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
Ligne 34 : |
Ligne 38 : |
| Installing micropython-abc 0.0.1 from https://pypi.python.org/packages/fe/9e/56d08ca07866279e6d3506d469e632471487a840eef38ab835d0fdbcafd0/micropython-abc-0.0.1.tar.gz | | Installing micropython-abc 0.0.1 from https://pypi.python.org/packages/fe/9e/56d08ca07866279e6d3506d469e632471487a840eef38ab835d0fdbcafd0/micropython-abc-0.0.1.tar.gz |
| </nowiki> | | </nowiki> |
| + | |
| + | il est ensuite possible de contrôler l'installation comme le montre la sessions REPL suivante. |
| + | * Le répertoire {{fname|lib}} à été créé dans la racine du système de fichier. |
| + | * Le répertoire {{fname|lib}} contient bien la bibliothèque {{fname|abc.py}}. |
| + | |
| + | <syntaxhighlight lang="python"> |
| + | >>> import os |
| + | >>> os.listdir() |
| + | ['boot.py', 'mqtt_sub.py', 'webrepl_cfg.py', 'mqtt_pub.py', 'main._', 'aio_demo.py', 'diss_irq.py', 'lib'] |
| + | >>> os.listdir('lib') |
| + | ['abc.py'] |
| + | >>> import abc |
| + | >>> help( abc ) |
| + | object <module 'abc'> is of type module |
| + | </syntaxhighlight> |
| + | |
| + | C'est trop de la balle. |