Python3安装海龟包turtle时报错Failed building wheel for Twisted的解决办法

Python3安装turtle时先是出现如下报错:

C:\Users\XXX>pip install turtle
Collecting turtle
  Downloading https://files.pythonhosted.org/packages/ff/f0/21a42e9e424d24bdd0e509d5ed3c7dfb8f47d962d9c044dba903b0b4a26f/turtle-0.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\XXX\AppData\Local\Temp\pip-install-qm1_x9jy\turtle\setup.py", line 40
        except ValueError, ve:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\XXX\AppData\Local\Temp\pip-install-qm1_x9jy\turtle\

为解决上述问题可以参考:https://blog.csdn.net/m511655654/article/details/86214086

    解决掉上述问题后,当我使用pip再次直接在线安装turtle时,报错Failed building wheel for Twisted,于是我又用pip在线安装Twisted,还是报错Failed building wheel for Twisted,网上查了下资料,发现是Twisted版本的问题,Twisted的安装需要根据操作系统和python版本选择合适Twisted的版本,我用的win10 64位,python 3.6,所以选择的Twisted版本是Twisted-18.9.0-cp36-cp36m-win_amd64.whl,文件下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

下载完成后使用命令pip install -e 'file_path'来安装 Twisted。我的文件路径为D:\Python\Python36\Lib\Twisted-18.9.0-cp36-cp36m-win_amd64.whl,所以完整的安装命令为:

    pip install -e D:\Python\Python36\Lib\Twisted-18.9.0-cp36-cp36m-win_amd64.whl

    Twisted安装完成后,就可以再次使用命令pip install turtle在线直接安装海龟包turtle。

其他参考:

https://blog.csdn.net/qq_36711420/article/details/79487772

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值