centos 7 上的 Python 3.6 中缺少 turtle 图形模块?

turtle graphics module missing from Python 3.6 on centos 7?

我搜索了 google 和这个网站,但似乎找不到任何与此问题具体相关的内容。摘要是:

import turtle

def draw_something():
    print("Hello world")

draw_something()

ModuleNotFoundError: No module named 'turtle'

我认为 turtle 是 Python3.6 的 Centos 7 安装的一部分。

注意,我从这里获得了 Python3.6 rpm:

sudo yum install https://centos7.iuscommunity.org/ius-release.rpm

这是 Centos 7 特有的东西还是我是个傻瓜?

谢谢

如果您 运行 pip search turtle 并通读了描述, PythonTurtle 模块听起来就像您缺少的那个,所以只是 运行 pip3 install PythonTurtle

所以我知道发生了什么。

缺少 Python 3.6 的 tkinter 包,这是 turtle 的依赖项。

sudo yum -y install python36u-tkinter

这解决了问题。