I'm trying to download the Turtle Graphics Package for Python, so I enter the following command into my linux terminal:
myusername@penguin:~/Pys$ pip3 install turtle
And here's the error I encountered:
Collecting turtle
Using cached https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-c6dr99ga/turtle/setup.py", line 40
except ValueError, ve:
^
SyntaxError: invalid syntax
It seems like there's an syntax error in the file I was trying to download. Is there a way I can fix that?
Turtle graphics is already part of Python standard library, you don't need to install it.
See: https://docs.python.org/3/library/turtle.html
Just import it:
import turtle
There seems to be an issue with how the setup.py has been written.
To fix this, run
pip3 install turtle
Your output will contain a link to the turtle tar.gz file ( https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz )
run wget <paste_link_here>
or manually download the tar.gz file from the link
extract the folder using tar -xvf turtle-0.0.2.tar.gz
go into the turtle directory and open setup.py in any text editor.
At line 40, change
`except ValueError, ve:`
to
except ValueError as ve:
then compress it the folder to a tar file again and then run pip3 install on the local file
pip3 install turtle-0.0.2.tar.xz
This should fix the problems with the package
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.