14-11-2023
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
# WebServer
|
||||
# Python
|
||||
|
||||
|
||||
|
||||
[Conda](conda.md)
|
||||
|
||||
[Django](Django.md)
|
||||
|
||||
[pip](pip.md)
|
||||
|
||||
[python3](python3.md)
|
||||
|
||||
[pipx](pipx.md)
|
||||
|
||||
[poetry](poetry.md)
|
||||
|
||||
[venv](virtuel.md)
|
||||
|
||||
@@ -452,6 +452,58 @@ mkdocs-tooltipster-links-plugin (0.1.0) - An MkDocs plugin
|
||||
|
||||
|
||||
|
||||
#### Connaitre toutes les versions disponibles d'un module:
|
||||
|
||||
*Depuis pypi.org avec curl:*
|
||||
|
||||
```bash
|
||||
# $ curl -L -s "https://pypi.org/pypi/<$PACKAGE>/json" | jq -r '.releases | keys | .[]' | sort -V
|
||||
|
||||
$ curl -L -s "https://pypi.org/pypi/geomet/json" | jq -r '.releases | keys | .[]' | sort -V
|
||||
0.1.0
|
||||
0.1.1
|
||||
0.1.2
|
||||
0.2.0.post2
|
||||
0.2.1
|
||||
0.2.1.post1
|
||||
0.3.0
|
||||
```
|
||||
|
||||
*pip >= 21.2*
|
||||
|
||||
```bash
|
||||
$ pip index versions geomet
|
||||
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
|
||||
geomet (0.3.0)
|
||||
Available versions: 0.3.0, 0.2.1.post1, 0.2.0.post2, 0.1.2, 0.1.1, 0.1.0
|
||||
INSTALLED: 0.3.0
|
||||
LATEST: 0.3.0
|
||||
```
|
||||
|
||||
*Précédentes versions de pip:*
|
||||
|
||||
```bash
|
||||
# en ne précisant pas la version
|
||||
$ pip install geomet==
|
||||
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
|
||||
ERROR: Ignored the following versions that require a different python version: 0.2.1 Requires-Python >2.6, !=3.3.*, <3.8
|
||||
ERROR: Could not find a version that satisfies the requirement geomet== (from versions: 0.1.0, 0.1.1, 0.1.2, 0.2.0.post2, 0.2.1.post1, 0.3.0)
|
||||
ERROR: No matching distribution found for geomet==
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pip install geomet== --use-deprecated=legacy-resolver
|
||||
```
|
||||
|
||||
```bash
|
||||
# en spécifiant une version qui n'existe pas:
|
||||
$ pip install geomet==9999
|
||||
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
|
||||
ERROR: Ignored the following versions that require a different python version: 0.2.1 Requires-Python >2.6, !=3.3.*, <3.8
|
||||
ERROR: Could not find a version that satisfies the requirement geomet==9999 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.2.0.post2, 0.2.1.post1, 0.3.0)
|
||||
ERROR: No matching distribution found for geomet==9999
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Dépendances:
|
||||
|
||||
@@ -8,7 +8,7 @@ Python 3 peut s'installer avec Homebrew:
|
||||
$ brew install python3
|
||||
```
|
||||
|
||||
Les extensions Python 3 s'installent dans `/usr/local/lib/python3.7/site-packages/`
|
||||
Les extensions Python 3 s'installent dans `/usr/local/lib/python3.7/site-packages/` (Intel) ou `/opt/homebrew/lib/python3.9/site-packages/` (Arm)
|
||||
|
||||
Pour lancer un script Python 3:
|
||||
|
||||
|
||||
@@ -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