In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
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.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.