Wie man Python tox ImportError repariert: cannot import name 'cmdline' from 'tox'
Problem:
Beim Versuch, Ihre Unit-Tests mit tox auszuführen, sehen Sie die folgende Fehlermeldung:
tox_traceback.txt
Traceback (most recent call last):
File "/home/uli/.local/bin/tox", line 5, in <module>
from tox import cmdline
ImportError: cannot import name 'cmdline' from 'tox' (/usr/local/lib/python3.10/dist-packages/tox/__init__.py)Lösung
Sie verwenden eine ältere Version von tox als Executable. Um herauszufinden, welche Executable Sie verwenden, überprüfen Sie diese Zeile der Fehlermeldung:
tox_exec_path.txt
File "/home/uli/.local/bin/tox", line 5, in <module>In unserem Fall ist die Executable
tox_exec_path.txt
/home/uli/.local/bin/toxLöschen Sie diese Datei!
Danach sollte tox funktionieren. Wenn nicht, aktualisieren Sie tox mit
upgrade_tox.sh
pip install -U toxCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow