解决python3.7安装turtle报错ERROR: Command errored out with exit status 1:
2020-01-11 19:01
1206 查看
文章目录
- 问题:python3.7安装turtle报错ERROR: Command errored out with exit status 1:
- 解决方法:
- 1.在pypi网站下载 [turtle 0.0.2](https://pypi.org/project/turtle/0.0.2/#files)
- 2.将下载的turtle-0.0.2.tar.gz文件解压,修改setup.py文件
- 3.安装turtle模块
问题:python3.7安装turtle报错ERROR: Command errored out with exit status 1:
pip install turtle出现如下图的报错
解决方法:
查看报错信息会得知错误原因是setup.py文件的第40行出现语法错误;
1.在pypi网站下载 turtle 0.0.2
2.将下载的turtle-0.0.2.tar.gz文件解压,修改setup.py文件
修改第40行代码如下(其实就是增加了括号,python2的语法格式是没有括号的,但是python3没有括号就会报错,就像print函数)
except (ValueError, ve):
3.安装turtle模块
pip install -e C:\Users\LU\AppData\Local\Programs\Python\Python37-32\turtle-0.0.2
-e后面为turtle-0.0.2地址所在地
执行上述命令后即可成功安装
例程:绘制国旗1
import turtle # 导入turtle模块 turtle.setup(1200, 800, 0, 0) turtle.bgcolor("red") # 背景颜色 turtle.color('yellow') # 五角星颜色 turtle.speed(10) # 设置画笔绘制速度 # 绘制最大的主五角星 turtle.begin_fill() # 填充绘制的五角星 turtle.up() # 抬笔不绘制 turtle.goto(-520, 240) # 画笔设置到起始位置 turtle.down() # 落笔进行绘制 for i in range(5): # 循环5次 turtle.forward(240) # 向前移动150 turtle.right(144) # 以角度单位向右转动 turtle.end_fill() # 结束填充 # 绘制第1颗副星 turtle.begin_fill() turtle.up() turtle.goto(-230,345) turtle.setheading(305) turtle.down() for i in range (5): turtle.forward(70) turtle.left(144) turtle.end_fill() # 绘制第2颗副星 turtle.begin_fill() turtle.up() turtle.goto(-150,230) turtle.setheading(30) turtle.down() for i in range (5): turtle.forward(70) turtle.right(144) turtle.end_fill() # 绘制第3颗副星 turtle.begin_fill() turtle.up() turtle.goto(-155,130) turtle.setheading(0) turtle.down() for i in range (5): turtle.forward(70) turtle.right(144) turtle.end_fill() # 绘制第4颗副星 turtle.begin_fill() turtle.up() turtle.goto(-230,68) turtle.setheading(300) turtle.down() for i in range (5): turtle.forward(70) turtle.left(144) turtle.end_fill() turtle.hideturtle() # 隐藏箭头 turtle.done()
参考来源
python3.7安装turtle(单纯为了好玩)
windows下python3安装turtle安装以及解决方案
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- python安装第三方库遇到 ERROR: Command errored out with exit status 1:
- ubuntu18.04 python3.7 pip安装mysqlclient报错ERROR: Command errored out with exit status 1
- python2.7 安装MYSQL-python 报错:ERROR: Command errored out with exit status 1:
- CentOS7上 pip install MySQL-python 安装失败(error: command 'gcc' failed with exit status 1)的解决办法
- 解决Python扩展程序编译安装的error: command 'mt.exe' failed with exit status 31
- 安装python-MySQLdb 出现error: command 'gcc' failed with exit status 1的解决方法
- MAC安装python模块碰到“error: command 'cc' failed with exit status 1”解决办法
- 关于Python安装模块出现error: command 'gcc' failed with exit status 1错误的解决方法
- 词云:解决pip install wordcloud安装过程中报错“error: command 'x86_64-linux-gnu-gcc' failed with exit status 1”问题
- mac下安装mysql-python包报unable to execute llvm-gcc-4.2: No such file or directory error: command 'llvm-gcc-4.2' failed with exit status 1解决方法
- 用pip下载beatifulSoup报错ERROR: Command errored out with exit status 1: python setup.py egg_info Check th
- Python Mac安装 mysqlclient 包报错“error: command 'clang' failed with exit status 1”解决办法
- 成功解决ERROR: Command errored out with exit status 1: command: 'f:\program files\python\python36\pyt
- 关于Python安装模块出现error: command 'gcc' failed with exit status 1错误的解决方法
- [CentOS]安装MySQL-python,error: Setup script exited with error: command 'gcc' failed with exit status
- 关于python 安装lxml-4.1.1 报 error: command 'gcc' failed with exit status 1
- Centos python3安装paramiko出现error: command 'gcc' failed with exit status 1
- ubuntu下安装cryptography报错 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
- centos7.3安装paramiko报error: command 'gcc' failed with exit status 1的解决办法
- python 安装superset:error: Setup script exited with error: command 'gcc' failed with exit status 1