![d5935bf622fcd44385ecde91bd1159e0.png](https://i-blog.csdnimg.cn/blog_migrate/7bceaa5af6429ce9977939294e461ec4.jpeg)
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Command errored out with exit status 1:
command: 'F:pythonProjectvenvScriptspython.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:UsersAdministerAppDataLocalTemppycharm-packagingturtlesetup.py'"'"'; __file__='"'"'C:UsersAdministerAppDataLocalTemppycharm-packagingturtlesetup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersAdministerAppDataLocalTemppip-pip-egg-info-2atfqexu'
cwd: C:UsersAdministerAppDataLocalTemppycharm-packagingturtle
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:UsersAdministerAppDataLocalTemppycharm-packagingturtlesetup.py", line 40
except ValueError, ve:
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
我找到有人说是pycharm没有办法识别turtle,需要修改turtle.py,在lib里找见turtle.py然后添加下面这些代码。
![66b43ac010580a0609edb0603f6f52d3.png](https://i-blog.csdnimg.cn/blog_migrate/3daa15ee0e4594fb3ce3e411120a30a5.png)
__all__ = ['ScrolledCanvas', 'TurtleScreen', 'Screen', 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D', 'back', 'backward', 'begin_fill', 'begin_poly', 'bk', 'addshape', 'bgcolor', 'bgpic', 'bye', 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas', 'getshapes', 'listen', 'mainloop', 'mode', 'numinput', 'onkey', 'onkeypress', 'onkeyrelease', 'onscreenclick', 'ontimer', 'register_shape', 'resetscreen', 'screensize', 'setup', 'Terminator', 'setworldcoordinates', 'textinput', 'title', 'tracer', 'turtles', 'update', 'window_height', 'window_width', 'write_docstringdict', 'done', 'circle', 'clear', 'clearstamp', 'clearstamps', 'clone', 'color', 'degrees', 'distance', 'dot', 'down', 'end_fill', 'end_poly', 'fd', 'fillcolor', 'filling', 'forward', 'get_poly', 'getpen', 'getscreen', 'get_shapepoly', 'getturtle', 'goto', 'heading', 'hideturtle', 'home', 'ht', 'isdown', 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd', 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', 'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', 'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'shapetransform', 'shearfactor', 'showturtle', 'speed', 'st', 'stamp', 'tilt', 'tiltangle', 'towards', 'turtlesize', 'undo', 'undobufferentries', 'up', 'width', 'write', 'xcor', 'ycor']
![5eb8b97ff3fdf9f336f7cb928faf0be7.png](https://i-blog.csdnimg.cn/blog_migrate/f8298ae2cbb7fee5942ad5ac35f5a166.jpeg)
尝试之后还是没用,只能根据错误来找哪里出了问题。发现是setup.py文件有问题,
就去官网(
turtlepypi.org![3dba1471207638fae45485298da3a16c.png](https://i-blog.csdnimg.cn/blog_migrate/c0e5aa705513d4797401e659eee944be.jpeg)
)下载了turtle的安装包,找见setup.py文件,吧第四十行加上()
![928e0393c2a6e421ef1d222708cd3106.png](https://i-blog.csdnimg.cn/blog_migrate/aa483258a1698212cda8db044d7a42c8.png)
然后在pycharm的terminal里install一下。(绝对路径就是你放turtle安装包的电脑上的路径)
pip install 绝对路径/turtle-0.0.2
成功之后就可以在file->setting->project:pythonproject->python interpreter里看到turtle了,说明导入成功。
![dd46c14ee7353c434d7db515a838ac53.png](https://i-blog.csdnimg.cn/blog_migrate/182b55f2b36a730dd0ccbe3d7d9d689e.png)