如何在linux上使用python3安装龟

时间:2016-10-06 20:47:36

标签: python-3.5

当我安装龟时,遇到这样的问题:

enter image description here

我的python版本是3.5.2,OS是Ubuntu 16.04 LTS

5 个答案:

答案 0 :(得分:4)

apt install python3-tk

它在Linux Mint和Ubuntu上经过测试并完美运行......
编辑:
原因是因为turtle基于tkinter,例如: enter image description here

答案 1 :(得分:1)

我假设您要求Turtle绘制forwardleft等。

它已经安装了Python。你不必安装它。您可能需要使用python3-tk或更确切地说pip3 install python3-tk

来安装apt install python3-tk

pip search turtle

结果的一部分

turtle (0.0.2) - Turtle is an HTTP proxy whose purpose is to throttle connections to
                 specific hostnames to avoid breaking terms of usage of those API
                 providers (like del.icio.us, technorati and so on).

您尝试安装一些HTTP proxy

except ValueError, ve:在Python 2中是正确的语法,但在Python 3中则不行。

答案 2 :(得分:1)

我正在使用Ubuntu 18.10,最近在将Python 3配置为默认环境后,出现了相同的错误。 我使用此命令对其进行了重新配置,并且可以正常工作。

sudo apt install python3-tk

成功!

答案 3 :(得分:0)

pip install python-tk

然后转到python shell并键入

from turtle import*
fd(100)

答案 4 :(得分:0)

我有同样的错误,但是在Mac OS上,我尝试通过brew更新我的python。这解决了我的问题。 首先,授予brew命令访问共享文件的权限,

sudo chown -R $(whoiam) /usr/local/share

这是brew:D的另一个问题,您可以测试下一个命令,并仅在需要时使用此命令。 最后,

brew upgrade python3