安装yaml报错:ERROR: Cannot uninstall 'PyYAML'.

文章目录:

  • 一、错误原因分析
  • 二、最终错误解决方式

一、错误原因分析

1、开始安装
我是一开始安装yaml,使用命令:

pip install yaml

正确安装,且可以在命令行下正确导入,然后在执行程序的时候又报错:AttributeError: module 'yaml' has no attribute 'FullLoader'然后我就查看了一下我安装的yaml的版本:

pip show yaml   # 显示是3.12版本,版本太老

2、错误探索1
网上查看教程,说是要更新yaml的版本到5.2,更新的方式如下:

pip install -U PyYAML

更新的过程中又报错:

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

然后又继续查找如何解决这个问题,大部分给出的解决方案是:把site-packages下的yaml文件全部删除干净,你猜怎么着,LZ全部删除了,结果安装的时候还是这个BY,你气不气,无奈呀!

3、错误探索2

无奈,我只能去PyPi网站上去下载轮子了,然后直接安装了:

  • PyYAML-5.2-cp27-cp27m-win_amd64.whl
  • PyYAML-5.2-cp27-cp27m-win32.whl

然后直接安装轮子:

pip install PyYAML-5.2-cp27-cp27m-win_amd64.whl
# 然后说是平台不支持,我一看是amd可能不支持,于是我又试了一下32的pip install PyYAML-5.2-cp27-cp27m-win32.whl
# 同样是平台不支持,无语至极

看来是探索是失败的,另辟蹊径吧!

二、最终错误解决方式

使用下面的安装方式解决:

# 亲测可用
pip install --ignore-installed PyYAML

还有一种,这个我没有测试,你可以试一下:

pip install  --force-reinstall PyYAML

pip install docker-py --ignore-installed PyYAML

参考:
1、https://github.com/pypa/pip/issues/5247
2、https://stackoverflow.com/questions/49911550/how-to-upgrade-disutils-package-pyyaml




♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠

安装yaml报错:ERROR: Cannot uninstall 'PyYAML'.相关推荐

  1. Mac用Pycharm安装mediapipe报错ERROR: Could not find a version that satisfies the requirement mediapipe

    问题 因为最近要用python做一个手部检测的项目,于是用找了个开源的程序跑了跑,发现安装mediapipe的时候会报错 ERROR: Could not find a version that sa ...

  2. 安装rabbitMq报错:error: unpacking of archive failed on file /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.9

    安装rabbitMq报错: 错误提示:error: unpagacking of archive failed on file /usr/lib/rabbitmq/lib/rabbitmq_serve ...

  3. 在Linux中安装MySQL报错“error: Failed dependencies: mysql-community-libs(x86-32) >= 5.7.9 is needed by my“

    异常 在Linux中安装MySQL报错: 原因 因为缺少相关的依赖,所以要先安装这些依赖才能安装MySQL成功. 解决 (注意:这种方法是错误的,安装后并不能启动MySQL成功) 在每个安装指令后面添 ...

  4. django2.0 在安装mysqlclient 报错ERROR: Command errored out with exit status 1: python setup.py egg_info

    环境:centos7 +  Django2.0 + python3.6 django2.0连接mysql需要安装PyMySQL和mysqlclient pip3 install PyMySQL pip ...

  5. 安装kerberos报错 error: command 'gcc' failed with exit status 1

    pip install kerberos 报错:error: command 'gcc' failed with exit status 1 安装环境工具 yum install gcc libffi ...

  6. Mac os更新系统后安装scrapy报错error: command ‘xcrun‘ failed with exit status 1

    查看报错信息: In file included from src/twisted/test/raiser.c:4: In file included from /Library/Developer/ ...

  7. Windows 下使用pip install 安装出现报错ERROR: Cannot unpack file解决办法

    使用豆瓣园安装robotframework-ride时,出现Cannot unpack file报错: ERROR: Cannot unpack file C:\Users\ZHANGW~1\AppD ...

  8. 遇到问题--k8s--helm安装prometheus报错Error: failed to download “stable/prometheus-operator“

    情况 使用helm安装prometheus命令如下: helm install prometheus stable/prometheus-operator 遇到报错: Error: failed to ...

  9. yum安装Jenkins报错Error in PREIN scriptlet in rpm package jenkins-2.204.5-1.1.noarch

    个人博客站点:http://www.johnlee.ink/ 解决方案: [root@jenkins data]# rm -f /etc/sysconfig/jenkins 解决思路: 1.通过Yum ...

最新文章

  1. 如何优雅设计 API 接口,实现统一格式返回?
  2. android对话框的使用(下)
  3. POJ - 1961 最小循环节
  4. Kubernetes——基本概念与理论
  5. GPIO8种方式小总结
  6. c++ 对象起始地址 指针靠齐_你需要知道的各种指针运算
  7. 【2017级面向对象程序设计】第2次成绩排行
  8. android 进程
  9. MySql字符串与时间日期之间的的转换
  10. 手机页面rem响应式布局
  11. 浙大翁凯老师Java课堂学习记录(第三周)
  12. Java技术栈思维导图
  13. 【看动漫学编程】程序员在异世界生个娃 第3篇:搞不好我就是个王者
  14. 基于MFCC参数的元音识别
  15. 【转载】《Real-Time Rendering 3rd》 提炼总结】(二) 第二章 · 图形渲染管线 The Graphics Rendering Pipeline
  16. OpenGL纹理详解
  17. QQ跨站漏洞巧利用一例【强迫别人帮你买QQ秀】【应该以失效】
  18. Go 程序崩了?煎鱼教你用 PProf 工具来救火!
  19. AI 沦为炒作的工具?
  20. 人事管理系统 v4.1.8(源码)

热门文章

  1. [Redux-Observable Unit Testing] Mocking an ajax request when testing epics
  2. PHP 单例模式继承的实现方式
  3. ZedBoard学习(5)-ZedBoard和System Generator
  4. 如何为WCF应用添加X509证书和安全验证
  5. python是高级动态编程语言-python是一种跨平台、开源、免费的高级动态编程语言,对么...
  6. pycharm和python区别-一些 PyCharm 的使用和设置建议
  7. ipython安装教程-CentOS 5安装IPython
  8. 函数式编程语言python-函数式编程语言
  9. python 装饰器 参数-[Python]写个带参数的装饰器
  10. python绘制动态图-Python图像处理之gif动态图的解析与合成操作详解