【问题标题】:Got an error while installing turtle library安装turtle库时出错
【发布时间】:2020-04-20 10:26:40
【问题描述】:

下面给出的错误:

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting turtle
  Using cached turtle-0.0.2.tar.gz (11 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\soura\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\soura\\AppData\\
Local\\Temp\\pip-install-fovg_cud\\turtle\\setup.py'"'"'; __file__='"'"'C:\\Users\\soura\\AppData\\Local\\Temp\\pip-install-fovg_cud\\turtle\\setup.py'"'"';f=getattr
(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --eg
g-base 'C:\Users\soura\AppData\Local\Temp\pip-install-fovg_cud\turtle\pip-egg-info'
         cwd: C:\Users\soura\AppData\Local\Temp\pip-install-fovg_cud\turtle\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\soura\AppData\Local\Temp\pip-install-fovg_cud\turtle\setup.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.

【问题讨论】:

  • 错误信息真的很难阅读。请使用代码标签来格式化消息。
  • 您的错误显示“检查日志以获取完整的命令输出”。找到您的日志文件所在的位置并打开它以发现更实质性的错误。
  • except 错误看起来您正在使用带有 python 3 的 python2 程序

标签: python python-3.x python-turtle


【解决方案1】:

在您的代码中,您的代码中的 except 旁边有一个语法错误。

根据报错,需要将第1行改为:

except ValueError:
    #your code here

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-03
    • 1970-01-01
    • 2018-02-14
    • 2019-01-12
    • 2019-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多