如何用pip正确处理冲突的distutils库?

2024-05-14 16:34:46 发布

您现在位置:Python中文网/ 问答频道 /正文

pip版本升级到10.0.0后,如果与distutils安装的包存在版本冲突,则使用pip安装将失败:

Cannot uninstall '***'. 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.

这可以用于PyYAML, pyOpenSSL, urllib3, chardet等。

我尝试通过卸载相应的包来管理此问题,例如

python-yaml python-openssl python-urllib3 python-chardet

使用apt-get(Ubuntu),然后使用pip重新安装这些库

然而,正如apt-get预期的那样,删除也会导致删除许多依赖的附加系统包,这似乎不是一个好的做法:

The following packages will be REMOVED:
apt-xapian-index cloud-init landscape-client-ui-install oneconf python-aptdaemon python-aptdaemon.gtk3widgets python-chardet python-cupshelpers python-debian python-openssl python-pip python-requests python-ubuntu-sso-client python-urllib3 python-yaml sessioninstaller software-center ssh-import-id system-config-printer-common system-config-printer-gnome system-config-printer-udev ubuntu-desktop ubuntu-release-upgrader-gtk ubuntu-sso-client ubuntu-sso-client-qt update-manager update-notifier update-notifier-common

我也不想将pip降级到旧版本。

那么,使用pip处理冲突的distutils库的最佳实践是什么?

注:我本以为pip是为了便于管理Python库,但这一事件使它变得足够复杂。


Tags: piptoclientconfigwhichubuntuaptupdate

热门问题