Bonjour,
Je ne sais pas trop si je suis au bon endroit.
Suite à la mise à jour et la migration vers la version 24.04, des bibliothèques Python ont été supprimés de mon ordi.
J'ai donc souhaité les réinstaller mais je rencontre des problèmes alors que j'ai un réel besoin de ces bibliothèques.
Pour l'instant, je m'en sors grâce à mon portable que je n'ai pas mis à jour.
Un programme qui fonctionne par exemple avec mon portable mais pas sur mon PC mis à jour :
et l'erreur qui est déclenchée:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import StaleElementReferenceException from selenium.webdriver.support import expected_conditions from selenium import webdriver from selenium.webdriver.chrome.service import Service service = Service() options = webdriver.ChromeOptions() options.add_argument("--start-maximized") driver = webdriver.Chrome(service=service, options=options) from selenium.webdriver.support.ui import WebDriverWait wait = WebDriverWait(driver, 20) from selenium.common.exceptions import ElementClickInterceptedException
J'ai effectué pas mal d'essais, notamment :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 WebDriverException: Unable to obtain working Selenium Manager binary; /usr/lib/python3/dist-packages/selenium/webdriver/common/linux/selenium-manager The above exception was the direct cause of the following exception: Traceback (most recent call last): File /usr/lib/python3/dist-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals) File /mnt/0DD2EA2C6FC1348E/UPS-cpge/ups-phys3.py:29 driver = webdriver.Chrome(service=service, options=options) File /usr/lib/python3/dist-packages/selenium/webdriver/chrome/webdriver.py:45 in __init__ super().__init__( File /usr/lib/python3/dist-packages/selenium/webdriver/chromium/webdriver.py:49 in __init__ self.service.path = DriverFinder.get_path(self.service, options) File /usr/lib/python3/dist-packages/selenium/webdriver/common/driver_finder.py:41 in get_path raise NoSuchDriverException(msg) from errNoSuchDriverException: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
Ce type de commande fonctionnait auparavant. Obligé de faire :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 sudo pip install selenium error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
Cela semble ok.
Code : Sélectionner tout - Visualiser dans une fenêtre à part sudo apt install python3-selenium
Du coup, je tente la même pour webdriver-manager et sans surprise :
Du coup, je tente l'autre façon d'installer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 sudo pip install webdriver-manager error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
Je précise que j'ai fait des essais avec le tiret du 6 et le tiret du 8 (underscore), sans succès de part et d'autre.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 sudo apt install python3-webdriver-manager Lecture des listes de paquets... Fait Construction de l'arbre des dépendances... Fait Lecture des informations d'état... Fait E: Impossible de trouver le paquet python3-webdriver-manager
J'ai trouvé des réponses avec venv mais je n'y comprends pas grand-chose.
Voilà, si vous avez des pistes, je suis preneur. Au cas où, j'utilise l'éditeur Spyder. Bon week-end à tous et toutes.
Partager