小编Ree*_*ews的帖子

当使用cx_Freeze和tkinter时,我得到:"DLL加载失败:找不到指定的模块." (Python 3.5.3)

使用cx_Freeze和Tkinter时,我收到消息:

File "C:\Users\VergilTheHuragok\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 35, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: DLL load failed: The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)

有些事情需要注意:

  • 我想使用Python 3+(目前使用3.5.3,32位).无论如何都不关心特定版本.
  • 我的项目有多个我需要编译的文件.据我所知,这给我留下了cx_Freeze或Nuitka.Nuitka有自己的问题.
  • 我使用的是Windows 10 Home Edition,64位

这是我目前的setup.py:

from cx_Freeze import setup, Executable    
import sys  

build_exe_options = {"packages": ["files", "tools"]}  

base = None    
if sys.platform == "win32":    
    base = "Win32GUI"    

setup(name="Name",  
      version="1.0",  
      description="Description",  
      options={"build_exe": build_exe_options},  
      executables=[Executable("main.py", base=base)],  
      package_dir={'': ''},  
      )
Run Code Online (Sandbox Code Playgroud)

我从互联网的各个角落尝试了很多解决方案.包括但不仅限于:

  • python的多个版本(以及相应的cx_Freeze/Tkinter版本)
  • 32位和64位版本
  • 用easygui取代Tkinter(显然easygui需要Tkinter才能工作)
  • 检查PATH变量
  • 重新启动我的电脑(不知道我的预期)
  • 卸载其他版本的python并修复正确的版本 …

python tkinter cx-freeze python-3.x

10
推荐指数
1
解决办法
8099
查看次数

标签 统计

cx-freeze ×1

python ×1

python-3.x ×1

tkinter ×1