Mah*_*han 0 python tkinter python-3.x
我在 stackover 和许多其他网站上尝试了所有解决方案。但它仍然给出同样的错误。我什至无法安装它。
C:\Users\***\Google Drive\Python>pip install tkinter
Collecting tkinter
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
C:\Users\***\Google Drive\Python>pip install Tkinter
Collecting Tkinter
Could not find a version that satisfies the requirement Tkinter (from versions: )
No matching distribution found for Tkinter
C:\Users\***\Google Drive\Python>pip install Tk
Collecting Tk
Could not find a version that satisfies the requirement Tk (from versions: )
No matching distribution found for Tk
C:\Users\***\Google Drive\Python>pip install tk
Collecting tk
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'Varolan bir ba?lant? uzaktaki bir ana bilgisayar taraf?ndan zorla kapat?ld?', None, 10054, None))': /simple/tk/
Could not find a version that satisfies the requirement tk (from versions: )
No matching distribution found for tk
C:\Users\***\Google Drive\Python>pip install python3-tk
Collecting python3-tk
Could not find a version that satisfies the requirement python3-tk (from versions: )
No matching distribution found for python3-tk
Run Code Online (Sandbox Code Playgroud)
看起来你在 Windows 上,在这种情况下你已经有了 tkinter(如果你运行 2.7 或更高版本)。看来你使用 Python 3 所以运行import tkinter. 查看文档
如果您使用的是 Linux/Mac/类似变体,那么您需要运行sudo apt-get install python3-tk. 它不是一个pip包,不能以这种方式安装。
如果该python -m tkinter命令在 Windows 上失败,则您的安装已损坏,或者如果在 Linux/Mac/Similar 上,则上述命令应该可以工作。
在 Windows 上,有两件事可能会出错:
如果您的安装已损坏,则重新安装您应该可以工作,但更有可能是您tck/tk and IDLE在安装时忘记检查该选项。要检查或安装,请重新运行安装程序并按modify。您应该会看到如下所示的框。确保然后tck/tk and IDLE确实有一个勾号:
并按 Next
| 归档时间: |
|
| 查看次数: |
7400 次 |
| 最近记录: |