matplotlib error - no module named tkinter

后端 未结 16 1656
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 04:10

I tried to use the matplotlib package via Pycharm IDE on windows 10. when I run this code:

from matplotlib import pyplot

I get the followin

相关标签:
16条回答
  • 2020-11-28 04:34

    On CentOS 7 and Python 3.4, the command is sudo yum install python34-tkinter

    On Redhat 7.4 with Python 3.6, the command is sudo yum install rh-python36-python-tkinter

    0 讨论(0)
  • 2020-11-28 04:36
    sudo apt-get install python3-tk
    

    Then,

    >> import tkinter # all fine
    

    Edit:

    For Windows, I think the problem is you didn't install complete Python package. Since Tkinter should be shipped with Python out of box. See: http://www.tkdocs.com/tutorial/install.html

    I suggest install ipython, which provides powerful shell and necessary packages as well.

    0 讨论(0)
  • 2020-11-28 04:37

    Since I'm using Python 3.7 on Ubuntu I had to use:

    sudo apt-get install python3.7-tk
    
    0 讨论(0)
  • 2020-11-28 04:38

    On Centos, the package names and commands are different. You'll need to do:

    sudo yum install tkinter
    

    To fix the problem.

    0 讨论(0)
提交回复
热议问题