why pip install turtle (graphics) error

1

I get the following error when installing turtle, what should I do?

$ sudo pip install turtle --proxy http://10.144.1.10:8080
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting turtle
  Using cached https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-smo98rwf/turtle/setup.py", line 40
        except ValueError, ve:
                         ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-smo98rwf/turtle/

I am using Fedora 31, and pip version:

$ pip --version
pip 19.1.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)

Some other python library can be installed successfully, like:

$ sudo pip install scipy --proxy http://10.144.1.10:8080
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/37/9d/a606dc7b17ef0b7326afd128e132b7a483d5611da603334842df75d92d3c/scipy-1.4.0-cp37-cp37m-manylinux1_x86_64.whl (26.1MB)
     |████████████████████████████████| 26.1MB 824kB/s 
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib64/python3.7/site-packages (from scipy) (1.17.4)
Installing collected packages: scipy
Successfully installed scipy-1.4.0

BTW, turtle seems not installed within my python...

$ python
Python 3.7.5 (default, Dec 15 2019, 17:54:26) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import turtle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'turtle'
>>> 

Summary:

turtle graphics is a part of python3 standard library, no need to install it. If import turtle shows error like "No module named...", it could be solved by, for example in Fedora, sudo dnf install python3-tkinter

Lane Ouyang

Posted 2019-12-18T06:47:15.523

Reputation: 340

Answers

3

Turtle graphics is already included in the Python standard library.

Also install the python3-tkinter package from the default Fedora repositories. python3-tkinter is a module for writing portable GUI applications with Python 3.x using Tk. Then try to run this Python code for drawing a circle.

import turtle

t = turtle.Turtle()
t.circle(50)

The package that you tried to install with sudo pip install turtle is an HTTP proxy package. It's not the right package for Turtle graphics.

karel

Posted 2019-12-18T06:47:15.523

Reputation: 11 374

Which one do you want, Turtle graphics or Turtle HTTP proxy? – karel – 2019-12-18T07:31:14.900

1I want Turtle graphics – Lane Ouyang – 2019-12-18T07:32:04.397

1Try installing the python3-tkinter package in Fedora from the default Fedora repositories. python3-tkinter is a module for writing portable GUI applications with Python 3.x using Tk. Then try to run the Python code for drawing a circle in my answer. – karel – 2019-12-18T07:35:46.943

Yes, after install the python3-tkinter package, the problem solved. Thank you! – Lane Ouyang – 2019-12-18T07:39:20.377