2016-04-11 2 views
0

私はtkinterとpython 3.5でアプリケーションを作成しています。私は64ビットのWindows 7を使用しています。しかし、 "import matplotlib.backends.tkagg as tkagg"が問題を引き起こしているようです。私はanaconda環境でも、その環境では動作しないようにしました。誰かが私を助けてくれますか?コードだtkagg(python)DLLの読み込みに失敗しました:%1は有効なWin32アプリケーションではありません

Traceback (most recent call last): 
    File "C:\Users\michele.dellamea\Desktop\matplot\tkinterrr.py", line 4, in <module> 
    from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg 
    File "C:\Users\michele.dellamea\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 13, in <module> 
    import matplotlib.backends.tkagg as tkagg 
    File "C:\Users\michele.dellamea\AppData\Local\Programs\Python\Python35-32\lib\site-packages\matplotlib\backends\tkagg.py", line 9, in <module> 
    from matplotlib.backends import _tkagg 
ImportError: DLL load failed: %1 is not a valid Win32 application. 
[Finished in 1.3s with exit code 1] 
[shell_cmd: python -u "C:\Users\michele.dellamea\Desktop\matplot\tkinterrr.py"] 
[dir: C:\Users\michele.dellamea\Desktop\matplot] 
[path: C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Users\michele.dellamea\AppData\Local\Programs\Python\Python35-32\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\michele.dellamea\AppData\Local\Continuum\Anaconda3;C:\Users\michele.dellamea\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\michele.dellamea\AppData\Local\Continuum\Anaconda3\Library\bin] 

:エラーだ

import matplotlib 
matplotlib.use("TkAgg") 

from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg 
from matplotlib.figure import Figure 
#import matplotlib.pylab as pylab 

import tkinter as tk 
from tkinter import ttk #css for tkinter 



LARGE_FONT = ("Verdana", 12) 


class SeaofBTCapp(tk.Tk): 

    def __init__(self, *args, **kwargs): #args all var, kwargs all dict 

     tk.Tk.__init__(self, *args, **kwargs) 

     tk.Tk.iconbitmap(self, default="agnul.jpg") 
     tk.Tk.wm_title(self, "Sea of BTC client") 

     container = tk.Frame(self) #frame hedge window 
     container.pack(side="top", fill="both", expand=True) 
     container.grid_rowconfigure(0, weight=1) 
     container.grid_columnconfigure(0, weight=1) 

     self.frames = {} 

     for F in (StartPage, PageOne, PageTwo, PageThree): 
      frame = F(container, self) 
      self.frames[F] = frame 
      frame.grid(row=0, column=0, sticky="nsew") #you specify all grid 

     self.show_frame(StartPage) 

    def show_frame(self, cont): 

     frame = self.frames[cont] # key 
     frame.tkraise() 

def qf(stringtoprint): 
    print(stringtoprint) 

class StartPage(tk.Frame): 

    def __init__(self, parent, controller): 
     tk.Frame.__init__(self, parent) 
     label = tk.Label(self, text="Start Page", font=LARGE_FONT) #Label class label object 
     label.pack(pady=10, padx=10) 

     button1 = ttk.Button(self, text="Visit Page 1", command=lambda: controller.show_frame(PageOne)) 
     button1.pack() 

     button2 = ttk.Button(self, text="Visit Page 2", command=lambda: controller.show_frame(PageTwo)) 
     button2.pack() 

     button3 = ttk.Button(self, text="Graph Page", command=lambda: controller.show_frame(PageThree)) 
     button3.pack() 

class PageOne(tk.Frame): 

    def __init__(self, parent, controller): 
     tk.Frame.__init__(self, parent) 
     label = tk.Label(self, text="Page 1", font=LARGE_FONT) #Label class label object 
     label.pack(pady=10, padx=10) 

     button1 = ttk.Button(self, text="Back to Home", command=lambda: controller.show_frame(StartPage)) 
     button1.pack() 

     button2 = ttk.Button(self, text="Page 2", command=lambda: controller.show_frame(PageTwo)) 
     button2.pack() 

class PageTwo(tk.Frame): 

    def __init__(self, parent, controller): 
     tk.Frame.__init__(self, parent) 
     label = tk.Label(self, text="Page 2", font=LARGE_FONT) #Label class label object 
     label.pack(pady=10, padx=10) 

     button1 = ttk.Button(self, text="Back to Home", command=lambda: controller.show_frame(StartPage)) 
     button1.pack() 

     button2 = ttk.Button(self, text="Page 1", command=lambda: controller.show_frame(PageOne)) 
     button2.pack() 

class PageThree(tk.Frame): 

    def __init__(self, parent, controller): 
     tk.Frame.__init__(self, parent) 
     label = tk.Label(self, text="Graph Page", font=LARGE_FONT) #Label class label object 
     label.pack(pady=10, padx=10) 

     button1 = ttk.Button(self, text="Back to Home", command=lambda: controller.show_frame(StartPage)) 
     button1.pack() 

     f = Figure(figsize=(5,5), dpi=100) 
     a = f.add_subplot(111) 
     a.plot([1,2,3,4,5,6,7,8],[5,6,1,3,8,9,3,5]) 

     canvas = FigureCanvasTkAgg(f, self) 
     canvas.show() 
     canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True) 

     toolbar = NavigationToolbar2TkAgg(canvas, self) 
     toolbar.update() 
     canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True) 


app = SeaofBTCapp() 
app.mainloop() 

答えて

0

ファイルを開くC:\ matplotlibの\バックエンド\プログラムファイル\ Pythonの3 \ Libの\のsite-packages \ backend_tkagg .pyddependency walkerとし、どのDLLが不足していて、どこが期待されているかを調べます。

私は同じ問題、バックエンドはmsvcp140.dll pythonFolder \ Libの\サイト・パッケージで行方不明ファイル\ matplotlibの\バックエンドフォルダを探しましたが、実際にpythonFolder \ Libの\部位特異的に存在していることを持っていましたパッケージ\ matplotlibフォルダー。だから私はそれを動作させるために正しいフォルダにコピーしました。

関連する問題