5

So my teacher in Python showed the turtle module, so I want to try it myself, but when I try to install the turtle module on my PC I have an error:
I'm using "pip" to install modules, so when I do "pip install turtle" on a console
(not Python console) I have an error :

Collecting turtle
using cached 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 "C:\Users\Daxxas\AppData\Local\Temp\pip-build-727hpv0w\turtle\setup.py", line40
except ValueError, ve:
                 ^
SyntaxError: invalid syntax

and there is this in red :

Command "python setup.py egg_info" failed with error code 1 C:\Users\Daxxas\AppData\Local\temp\pip-build-727hpv0w\turtle\

And I don't know what to do. There isn't pip's folder in "Temp".

So how can I fix this to be able to install the turtle module ?

ps : Is it possible to copy/paste something in a console ?

2
  • 2
    The syntax error looks like it is coming from a Python 2.x script being run with Python 3.x Commented Oct 19, 2016 at 12:56
  • In which case it's a bug in pip (or the module registered with pypi) that it even tries to install it! Commented Oct 19, 2016 at 13:08

4 Answers 4

12

Turtle is already included in the Python standard library; you don't need to install anything.

The library you were installing is a completely different thing (an HTTP proxy, apparently) which looks like it's not compatible with any recent Python version.

Sign up to request clarification or add additional context in comments.

5 Comments

I don't think there is a problem. Did you try just opening an interactive python session and trying import turtle?
I've tried in pyCharm, the line went gray like it didn't regonize it
Went grey or red? imports in pycharm sometimes go grey if they are unused (i.e. you haven't typed any other code yet.)
Traceback (most recent call last): File "C:/Users/Daxxas/PycharmProjects/turtle/turlebase.py", line 3, in <module> forward(100) NameError: name 'forward' is not defined Process finished with exit code 1 This is what I get with : import turtle forward(100)
But import turtle worked. You need to read the docs for the module, and either do something like from turtle import * to get the forward function defined, or do turtle.forward(100). (although, looking at the docs, you might need t = turtle.Turtle(); t.forward(100)
2

This might be happening because you are trying to install a library that is already included in the standard library.

For example, I was trying to install hashlib using pip and was getting a similar error

python -m pip install hashlib
Complete output from command python setup.py egg_info:
....
File "C:\Users\bla\AppData\Local\Temp\pip-build-l8pg66yd\hashlib\hashlib.py", line 80
        raise ValueError, "unsupported hash type"
                        ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\bla\AppData\Local\Temp\pip-build-l8pg66yd\hashlib\

If you are not able to resolve the library, you might have not correctly setup the python interpreter or SDK in your IDE. Check if that is the case.

Comments

0

If you name your file turtle.py, it will give you this error. I figured it out after I had finished checked my Python interpreter, settings, etc.

Comments

0

Is it possible to copy/paste something in a console ?

YES SHIFT+INSERT

This shortcut works well with console as well as with console tools ie vim, emacs, nano etc.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.