%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%95%9C%20%EC%9D%B4%EC%9C%A0.png)
를 설치할 때 다음과 같은 오류가 발생합니다 turtle
. 어떻게 해야 합니까?
$ 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/
저는 Fedora 31과 pip 버전을 사용하고 있습니다:
$ pip --version
pip 19.1.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)
다음과 같은 다른 Python 라이브러리를 성공적으로 설치할 수 있습니다.
$ 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
그런데, 거북이가 내 파이썬에 설치되지 않은 것 같습니다...
$ 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'
>>>
요약:
turtle graphics
python3 표준 라이브러리의 일부이므로 설치할 필요가 없습니다. "이름이 지정된 모듈이 없습니다..."와 같은 오류가 표시 되면 import turtle
예를 들어 Fedora에서 다음과 같이 해결할 수 있습니다.sudo dnf install python3-tkinter
답변1
거북이 그래픽Python 표준 라이브러리에 이미 포함되어 있습니다.
또한python3-tkinter기본 Fedora 리포지토리의 패키지. python3-tkinter는 Tk를 사용하여 Python 3.x로 이식 가능한 GUI 응용 프로그램을 작성하기 위한 모듈입니다. 그런 다음 원을 그리기 위해 이 Python 코드를 실행해 보세요.
import turtle
t = turtle.Turtle()
t.circle(50)
설치하려고 시도한 패키지는 sudo pip install turtle
HTTP 프록시 패키지입니다. Turtle 그래픽에 적합한 패키지가 아닙니다.