简体   繁体   English

pyinstaller-ImportError:没有名为Tkinter的模块(决策的所有变体)

[英]pyinstaller - ImportError: No module named Tkinter (all variants of decisions)

I use Python 2.7 Windows 8. 我使用Python 2.7 Windows 8。

When I was faced with this problem, it is still not aware of how much it has pitfalls. 当我面对这个问题时,它仍然不知道有多少陷阱。 Here I want to present all of the options that I have encountered and tested, as well as the option that I eventually helped. 在这里,我要介绍我遇到和测试过的所有选项,以及最终帮助我的选项。

1) I checked the spelling used by the module Tkinter or tkinter . 1)我检查了模块Tkinter或tkinter使用的拼写。

2) I read about how to use the pyinstaller , when used in the project modules: tkinter and matplotlib then was able to give up matplotlib , but it also did not affect the solution to my problem. 2)我了解如何使用pyinstaller ,在项目模块使用时: tkintermatplotlib然后能够放弃matplotlib ,但它也没有影响到解决我的问题。

3) Adds path to the module from the command line with the parameter p PyInstaller -y -F --distpath="." 3)使用参数p PyInstaller -y -F --distpath =“从命令行添加到模块的路径 -p "C:\\Python27\\Lib\\lib-tk" test.py -p“ C:\\ Python27 \\ Lib \\ lib-tk” test.py

4) Connect only the necessary parts of the module https://groups.google.com/forum/#!topic/pyinstaller/vtbKKt6v0is 4)仅连接模块https://groups.google.com/forum/#!topic/pyinstaller/vtbKKt6v0is的必要部分

5) Use pyinstaller option --hiddenimport=Tkinter and commented rows excludedimports in files \\PyInstaller\\hooks\\hook-PIL.py and hook-PIL.SpiderImagePlugin.py https://github.com/pyinstaller/pyinstaller/issues/1584 5)使用pyinstaller选项--hiddenimport=Tkinter并注释行excludedimports在文件\\PyInstaller\\hooks\\hook-PIL.pyhook-PIL.SpiderImagePlugin.py https://github.com/pyinstaller/pyinstaller/issues/1584中的 \\PyInstaller\\hooks\\hook-PIL.py hook-PIL.SpiderImagePlugin.py

What helped me to solve this problem: 是什么帮助我解决了这个问题:

1) Remove the Python . 1)删除Python

2) Make a backup of the folder in which the remains were from Python . 2)备份剩下的来自Python的文件夹。

3) Delete the folder in which you installed the Python (my problem is not solved without this item). 3)删除安装Python的文件夹(没有此项,我的问题将无法解决)。

4) Install new Python and all the necessary modules. 4)安装新的Python和所有必要的模块。

Following these simple manipulations things started to work :) 按照这些简单的操作,事情开始起作用:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM