AttributeError: module 'pickle' has no attribute 'load'

Probleme bei der Installation?
Antworten
SautaRoc
User
Beiträge: 48
Registriert: Donnerstag 20. September 2018, 13:18

Hallo, ich versuche mich gerade an Heatmaps mit Seaborn. Dazu habe ich folgenden Beispielscode aus dem Netz probiert:

Code: Alles auswählen

import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

# Load the example flights dataset and conver to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")

# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax)

Wenn ich das in Anaconda Spyder über die IPython Konsole laufen lasse wird mir eine Heatmap wie gewünscht erstellt. Nun möchte ich das auch über ein PowerShell fenster machen, nur dort kommt eine Fehlermeldung. Ist vermutlich völlig banal, aber da hänge ich jetzt schon länger...

Code: Alles auswählen

PS D:\Python\OI_Projekt\Python\OI_Daten\Test> python heatmap_test.py
Traceback (most recent call last):
  File "heatmap_test.py", line 13, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\Hans\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 122, in <module>
    from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
  File "C:\Users\Hans\Anaconda3\lib\site-packages\matplotlib\cbook.py", line 32, in <module>
    import numpy as np
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import add_newdocs
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 36, in <module>
    from . import numeric
  File "C:\Users\Hans\Anaconda3\lib\site-packages\numpy\core\numeric.py", line 37, in <module>
    import pickle
  File "D:\Python\OI_Projekt\Python\OI_Daten\Test\pickle.py", line 18, in <module>
    idx = pickle.load(f)
AttributeError: module 'pickle' has no attribute 'load'
PS D:\Python\OI_Projekt\Python\OI_Daten\Test>
Weiss hier jemand Rat?
SautaRoc
User
Beiträge: 48
Registriert: Donnerstag 20. September 2018, 13:18

ich konnte es lösen! In dem Verzeichnis geisterte eine pickle.py rum, die dort nichts zu suchen hat.
Antworten