在computer1上我使用的是Windows 7 64位,Python 2.7.6和PyCharm Community Edition 2016.2.3。
我可以在computer1上运行Python脚本。该脚本使用tkinter并具有以下行:from Tkinter import Tk
但是,当尝试在computer2上运行脚本时,我收到以下错误:
Traceback (most recent call last):
File "C:/report.py", line 4, in <module>
from Tkinter import Tk
File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module>
import FixTk
File "C:\Python27\lib\lib-tk\FixTk.py", line 65, in <module>
import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.
Computer2具有相同的Windows和python版本:Windows 7 64位,Python 2.7.6,但是不同版本的PyCharm。 当我在computer1上查找文件“tkinter”的位置时,它位于:
C:\Users\<my username>\.PyCharm2016.2\system\python_stubs\-762174762\_tkinter.py
在计算机2上,它位于:
C:\Users\<my username>\.PyCharm50\system\python_stubs\-762174762\_tkinter.py
我尝试在计算机2上卸载PyCharm并安装PyCharm版本2016.2.3。它没有帮助。
我该如何解决?如何使用tkinter在计算机2上运行脚本?