ImportError: Name 'sysconfig' kann nicht aus 'distutils' importiert werden (/usr/lib/python3.8/distutils/__init__.py)
Ich habe pip3 sudo apt-get install python3-pipdanach installiert , als ich den folgenden Befehl ausführte, um django zu installieren. sudo pip3 install djangoIch erhalte diesen Fehler:
Traceback (letzter Aufruf zuletzt): Datei "/ usr / bin / pip3", Zeile 9, aus der Pip-Import-Hauptdatei "/ usr / lib / python3 / dist-packages / pip / init .py", Zeile 14, in aus pip.utils importieren get_installed_distributions, get_prog Datei "/ usr / lib / python3 / dist-packages / pip / utils / init .py", Zeile 23, aus pip.locations importieren (Datei "/ usr / lib / python3 / dist -packages / pip / location.py ", Zeile 9, in von distutils import sysconfig ImportError: Name 'sysconfig' kann nicht von 'distutils' importiert werden (/usr/lib/python3.8/distutils/ init .py)
Wie behebe ich das?
Antworten
Ich habe kürzlich versucht, die Python3.9-Version in meinem Ubuntu ab Version 3.6 manuell zu installieren apt install python3.9. Dann war pip3 kaputt. Das Problem ist, dass Distutils nicht für die Version 3.9 erstellt wurden.
In meinem Fall bin ich gelaufen apt install python3.9-distutils, um mein Problem zu lösen.
Stellen Sie in Ihrem Fall sicher, dass Sie die 3.x-Version im Befehl distutils ändern.
Dies hat geholfen, aber dann habe ich einen weiteren Fehler erhalten: ImportError: Kein Modul mit dem Namen 'pip._internal'
Folgendes hat es behoben:
locken https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall