14-11-2023
This commit is contained in:
@@ -184,21 +184,107 @@ pipenv install requests
|
||||
|
||||
|
||||
|
||||
### Mise-à-jour de Python dans un venv
|
||||
|
||||
1. On sauvegarde les dépendances:
|
||||
|
||||
```bash
|
||||
~/venv master* ⇡
|
||||
❯ python3 -m venv rpd
|
||||
|
||||
> cd rpd
|
||||
|
||||
❯ bin/pip3 install -U pip setuptools
|
||||
|
||||
❯ cp /Users/bruno/Downloads/install.py /Users/bruno/Documents/venv/rpd
|
||||
|
||||
|
||||
|
||||
❯ source bin/activate
|
||||
~/Documents/venv mkdocs soco-cli
|
||||
|
||||
❯ source soco-cli/bin/activate
|
||||
soco-cli ❯ pip3 freeze > requirements.txt
|
||||
soco-cli ❯ deactivate
|
||||
```
|
||||
|
||||
2. On supprime le venv:
|
||||
|
||||
```bash
|
||||
❯ rm -rf soco-cli
|
||||
```
|
||||
|
||||
3. On recrée le venv (avec la version courante de python):
|
||||
|
||||
```bash
|
||||
# avec la version courante de python:
|
||||
❯ python3 -m venv soco-cli
|
||||
|
||||
# avec une version précise de python:
|
||||
❯ python3.10 -m venv soco-cli
|
||||
```
|
||||
|
||||
4. On met à jour les outils:
|
||||
|
||||
```bash
|
||||
❯ source soco-cli/bin/activate
|
||||
soco-cli ❯ pip3 install -U pip setuptools wheel
|
||||
```
|
||||
|
||||
5. On réinstalle les dépendances:
|
||||
|
||||
```bash
|
||||
soco-cli ❯ pip3 install -r requirements.txt
|
||||
soco-cli ❯ deactivate
|
||||
```
|
||||
|
||||
```
|
||||
❯ $HOME/Documents/venv/soco-cli/bin/soco -v
|
||||
soco-cli version: 0.4.52
|
||||
soco version: 0.28.0
|
||||
python version: 3.10.8
|
||||
command path: /Users/bruno/Documents/venv/soco-cli/bin/soco
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Installer LiveboxMonitor dans un venv
|
||||
|
||||
Cloner le [dépot](https://p-dor.github.io/LiveboxMonitor/):
|
||||
|
||||
```bash
|
||||
~/Downloads $ git clone https://github.com/p-dor/LiveboxMonitor.git
|
||||
```
|
||||
|
||||
Créer le venv:
|
||||
|
||||
```bash
|
||||
~/Documents/venv $ python -m venv liveboxmonitor
|
||||
```
|
||||
|
||||
Activer le venv:
|
||||
|
||||
```bash
|
||||
~/Documents/venv $ source liveboxmonitor/bin/activate
|
||||
```
|
||||
|
||||
Mettre à jour:
|
||||
|
||||
```bash
|
||||
~/Documents/venv liveboxmonitor ❯ pip3 install -U pip setuptools wheel
|
||||
Requirement already satisfied: pip in ./liveboxmonitor/lib/python3.10/site-packages (23.0)
|
||||
Requirement already satisfied: setuptools in ./liveboxmonitor/lib/python3.10/site-packages (67.2.0)
|
||||
Collecting setuptools
|
||||
```
|
||||
|
||||
Copier LiveboxMonitor dans le venv:
|
||||
|
||||
```bash
|
||||
~/Downloads/LiveboxMonitor $ cp -R * ~/Documents/venv/liveboxmonitor
|
||||
```
|
||||
|
||||
Installer les dépendances:
|
||||
|
||||
```bash
|
||||
~/Documents/venv/liveboxmonitor
|
||||
liveboxmonitor ❯ pip3 install -r requirements.txt
|
||||
Collecting PyQt6
|
||||
```
|
||||
|
||||
Créer un exécutable avec [PyInstaller](https://pyinstaller.org/en/stable/index.html):
|
||||
|
||||
```bash
|
||||
pyinstaller --paths liveboxmonitor/lib/python3.10/site-packages LiveboxMonitor.py
|
||||
|
||||
# Ne marche pas: PyQt6 est installé dans /opt/homebrew/lib
|
||||
```
|
||||
|
||||
https://stackoverflow.com/questions/55312146/how-to-include-only-needed-modules-in-pyinstaller#55312170
|
||||
|
||||
Reference in New Issue
Block a user