完美解决ImportError: No module named _tkinter的问题(python3.5 下安装python3-tk)

1. 问题描述:运行python文件时出现以下信息
 
 
[plain]  view plain  copy
在CODE上查看代码片 派生到我的代码片
  1. cryhelyxx@ada:~/python_workspace$ python httpurl.py   
  2. Traceback (most recent call last):  
  3.   File "httpurl.py", line 4, in <module>  
  4.     import Tkinter  
  5.   File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>  
  6.     import _tkinter # If this fails your Python may not be configured for Tk  
  7. ImportError: No module named _tkinter  
2. 解决方法:
终端安装python3下的Tkinter:

[html]  view plain  copy
  1. sudo apt-get install python3-tk  

1、换源

2、更新 sudo apt-get update

3、sudo apt-get install python3-tk

4、sudo apt-get install -f


参考链接:https://blog.csdn.net/superrunner_wujin/article/details/65945452

https://blog.csdn.net/qq_18293213/article/details/74483516





猜你喜欢

转载自blog.csdn.net/qian2213762498/article/details/80696940