python安装不了turtle,三种错误都一一解决

系统:Windows 7

1,第一个错误提示

pip is configured with locations that require TLS/SSL, however the ssl module in
 Python is not available.

.................
No matching distribution found for turtle
pip is configured with locations that require TLS/SSL, however the ssl module in
 Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming
 the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retrie
s exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS UR
L because the SSL module is not available.")) - skipping

解决::::::::::::::::

将"[Anaconda安装目录]\Library\bin"加入PATH后,问题解决。

2,第二个错误提示

Collecting turtle
  Using cached 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 "/tmp/pip-install-hpqxw6_s/turtle/setup.py", line 40
        except ValueError, ve:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hpqxw6_s/turtle/

解决方法::::::::::::

仔细查看安装turtle出错的错误信息,可以看到是个语法错误。
pip在下载turtle 0.0.2包后,会解压到本地再安装,提示的错误在解压的setup.py文件里面,
解决的办法就是:按照给定的链接,把turtle包下载到本地,手动解压,修改setup.py文件再安装。
打开setup.py文件,第40行修改为
 except (ValueError, ve):
原来的是Python2的写法,没有括号,加了括号之后Python3就能用了。
用pip3安装修:
 pip install -e d:/turtle-0.0.2
-e后面接上我们修改过setup.py文件的目录。
这样就搞定了。
另外,如果提示 python-tk 未安装,用apt命令安装就可以了:
sudo apt install python-tk

3,第三个错误提示

Command "f:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__=‘C:\\Users\\WONDER~1\\AppData\\Local\\Temp\\pip-build-90gvzc6m\\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\WONDER~1\AppData\Local\Temp\pip-2xl1_rnm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\WONDER~1\AppData\Local\Temp\pip-build-90gvzc6m\Twisted\

解决方法::::::::::::

首先从http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载twisted对应版本的whl文件(如我的Twisted-19.2.0-cp37-cp37m-win_amd64.whl),cp后面是Python版本,amd64代表64位,运行命令:

pip install D:\Twisted-19.2.0-cp37-cp37m-win_amd64.whl     (路径最好不要有中文)

再次运行 pip install -e d:/turtle-0.0.2

 

 

至此成功安装了,所有的错误估计都遇到了。

  • 21
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值