在Python3.4中,我有:
>>>import sys
>>>print(sys.platform)
win32
但该系统绝对是win64。
以下是tkinter__init__py中的一段代码:
import sys
if sys.platform == "win32":
# Attempt to configure Tcl/Tk without requiring PATH
from tkinter import _fix
导致ImportError到我的代码。追溯:
Traceback (most recent call last): File "H:/User/Henri/WorkSpace/Python/DeepLearning/Try/Try01/Read_MNIST.py", line 3, in <module>
import matplotlib.pyplot as plt File "D:\Python34\lib\site-packages\matplotlib\pyplot.py", line 98, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "D:\Python34\lib\site-packages\matplotlib\backends\__init__.py", line 28, in pylab_setup
globals(),locals(),[backend_name],0) File "D:\Python34\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 8, in <module>
import tkinter as Tk, tkinter.filedialog File "D:\Python34\lib\tkinter\__init__.py", line 36, in <module>
from tkinter import _fix File "D:\Python34\lib\tkinter\_fix.py", line 65, in <module>
import _tkinter ImportError: DLL load failed: %1 is invalid win32 application。
答案 0 :(得分:0)
你必须做一些摆弄,以确定你是在64或32位窗口运行。请参阅此问题:How do I determine if my python shell is executing in 32bit or 64bit mode on OS X?
Python非常具体关于sys.platform为windows返回的内容 - &gt; 'win32'或'cygwin'
确定Windows的版本取决于您:D。