Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately dete...

1 问题描述

在安装PyYaml的时候出现以下问题:
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.

2 问题原因

当前环境已经存在PyYaml包,可能不是通过pip安装,所以在更新的时候pip不能卸载旧版本。
我的旧版本是3.12,想更新的版本是5.3.1.

3 解决方案

3.1 pip install docker-py --ignore-installed PyYAML

docker-py即想要安装的包。由于我想要安装的包就是PyYAML,所以不适用。

3.2 pip install ~/Downloads/PyYAML-5.3.1.tar.gz --user

你可能感兴趣的:(Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately dete...)