I matplotlib und plotly in meinem Python-Skript zu importieren versuchen eine einfache Verteilung zu zeichnen. Früher, als ich das Skript ausführte, zeigte es nichts auf der Kommandozeile an und es schien, als würde es einfach die import
-Anweisung verarbeiten.Python 2.7: Importfehler für 'matplotlib' und 'plotly' (O X)
Um es zu debuggen, aktualisierte ich Python mit brew install python
danach und machte danach eine pip install --upgrade pip
. Mit dem Upgrade Pip, stellte ich sicher, dass Matplotlib und plotly installiert sind. Aber auf das Skript ausgeführt wird, erhalte ich die folgende Fehlermeldung auf Befehlszeile:
$ python script.py
Traceback (most recent call last):
File "script.py", line 5, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python2.7/site-packages/matplotlib/__init__.py", line 110, in <module>
import io
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Kann jemand bitte helfen Sie mir, dieses Problem zu beheben?
Vielen Dank im Voraus.
Haben Sie nach der Aktualisierung von Python die neuesten Versionen von matplotlib und plotly installiert? In welcher Version von Python warst du schon? –
@ HEADLESS_0NE, ja. Ich habe dasselbe nach der Installation bestätigt, indem ich 'pip install --upgrade matplotlib' und' pip install --upgrade plotly' probiert habe. –