Windows10系统turtle安装报错ERROR: Command errored out with exit status 1

  Windows 10系统安装Turtle时报错:

ERROR: Command errored out with exit status 1
File “C:\Users\NN\AppData\Local\Temp\pip-install-uh24l_4m\turtle\setup.py”, line 40
except ValueError, ve:
^
SyntaxError: invalid syntax
错误提示setup.py第40行有语法错误。

  PyCharm→Setting安装turtle:

Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第1张图片

  CMD下安装turtle:

Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第2张图片

  解决:手动下载turtle,turtle库安装包下载链接https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz

  解压turtle-0.0.2.tar.gz修改中setup.py中第40行这个语法错误(python2与python3差异语法问题,如下红色框部分):

Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第3张图片

  CMD用pip安装试试(将解压修改后的turtle-0.0.2放置于G:\Python3.8.2):

# 看到上面说pip有新版本可以升级就先升个级
C:\Users\NN>python -m pip install --upgrade pip
# 安装试试
C:\Users\NN>pip install G:\Python3.8.2\turtle-0.0.2

  执行结果不太美妙,提示“缺少Microsoft Visual C++”

error: Microsoft Visual C++ 14.0 is required.
 Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'g:\python3.8.2\python.exe' -u 
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NN\\AppData\\Local\\Temp\\pip-install-dk8a4zdz\\Twisted\\setup.py'"'"'; 
__file__='"'"'C:\\Users\\NN\\AppData\\Local\\Temp\\pip-install-dk8a4zdz\\Twisted\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)
(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 
'C:\Users\NN\AppData\Local\Temp\pip-record-u3_co01g\install-record.txt' --single-version-externally-managed --compile 
--install-headers 'g:\python3.8.2\Include\Twisted' Check the logs for full command output.

  Microsoft Visual C++ Build Tools可以从https://visualstudio.microsoft.com/downloads/或者这里下载安装:

Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第4张图片 Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第5张图片

  好了,曙光来临:

Windows10系统turtle安装报错ERROR: Command errored out with exit status 1_第6张图片

  安装成功!

2020年05月28日,雨,26°,PM2.5 34,喜欢钟哥第5522天…

你可能感兴趣的:(Python,其他问题,python,turtle,error)