Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution to the installation of Python drawing Turtle Library

Shulou Source: shulou.com Published: 2022-06-03 07:38:58 10月16日 Update

This article shows you the solution to the installation of the Python drawing Turtle library, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Today, a friend asked me about the installation of Turtle. Let's put it simply here.

On github, we can see that the library Turtle has not been updated for a long time, and there are some errors in python3.6, so it may not be able to install successfully in the case of a higher version of python. I also tried for a while to find out where the problem lies.

Problem 1: direct installation

If there is a syntax error, where is the problem with ok to fix it? open the setup.py file under the folder.

Problem 2 the Twisted library cannot be building, that is, it cannot be installed

Say it so professionally.

Since I can't install it, I have to install you.

Enter https://www.lfd.uci.edu/~gohlke/pythonlibs/

Download this guy and put it under a folder after downloading.

Install using pip install Twisted-18.9.0-cp36-cp36m-win_amd64.whl

OK installation completed

Install Turtle

It's basically done here, and it can be done in a simple step.

Use the command python install setup.py to complete the installation

It's done. The library has been installed.

Finally, give an example and try it.

From tkinter import mainloopfrom turtle import Turtlefrom time import clockdef tree (plist, l, a, f): if l > 3: lst = [] for p in plist: p.forward (l) Q = p.clone () p.left (a) q.right (a) lst.append (p) lst.append (Q) for x in tree (lst Ltalf, a, f): yield Nonedef maketree (): P = Turtle () p.setundobuffer (None) p.hideturtle () p.speed (0) p.getscreen (). Tracer (30 Letters 0) p.left (90) p.penup () p.forward (- 210) p.pendown () t = tree ([p], 200,65 0.6375) for x int: pass print (len (p.getscreen (). Turtles ()) def main (): a=clock () maketree () b=clock () return "done:% .2f sec."% (bmura) if _ name__ = = "_ main__": msg = main () print (msg) mainloop ()

It's perfect. Close up.

The above is the solution to the installation of the Python drawing Turtle library. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Questions documents methods drawings content skills folders knowledge mistakes conciseness success done concise professional that is examples orders great work done guy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei vpn Apple Linux Redmi