在openSUSE上安装pip时出错

6 投票
1 回答
4741 浏览
提问于 2025-04-17 15:47

我正在尝试在我的生产服务器上部署 pip,但遇到了一个很奇怪的错误,它试图安装一个已经安装好的组件,但却没有成功。

~> sudo zypper in python-pip
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: python-pip-1.0.2-3.1.2.noarch requires python = 2.7, but this requirement cannot be provided
  uninstallable providers: python-2.7.2-7.10.1.i586[Updates-for-openSUSE-12.1-12.1-1.4]
                   python-2.7.2-7.17.1.i586[Updates-for-openSUSE-12.1-12.1-1.4]
                   python-2.7.2-7.10.1.x86_64[Updates-for-openSUSE-12.1-12.1-1.4]
                   python-2.7.2-7.17.1.x86_64[Updates-for-openSUSE-12.1-12.1-1.4]
                   python-2.7.2-7.1.3.x86_64[openSUSE-12.1-12.1-1.4]
                   python-2.7.2-7.1.3.i586[repo-oss]
                   python-2.7.2-7.1.3.x86_64[repo-oss]
 Solution 1: deinstallation of patterns-openSUSE-minimal_base-conflicts 12.1-25.21.1.x86_64
 Solution 2: do not install python-pip-1.0.2-3.1.2.noarch
 Solution 3: do not install python-pip-1.0.2-3.1.2.noarch
 Solution 4: break python-pip-1.0.2-3.1.2.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/c] (c): c

这真让人难以置信,因为 python-2.7.2-7.17.1 已经在合适的平台上安装好了(x86_64)。

~> sudo zypper if python-base
Loading repository data...
Reading installed packages...


Information for package python-base:

Repository: Updates for openSUSE 12.1 12.1-1.4
Name: python-base
Version: 2.7.2-7.17.1
Arch: x86_64
Vendor: openSUSE
Installed: Yes
Status: up-to-date
Installed Size: 20.8 MiB
Summary: Python Interpreter base package
Description:
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

This package contains all of stand-alone Python files, minus binary
modules that would pull in extra dependencies.

卸载 patterns-openSUSE-minimal_base-conflicts 12.1-25.21.1.x86_64 可以暂时解决这个问题,但有没有更好的方法来彻底解决这个问题呢?

1 个回答

1

我遇到过类似的问题,问题出在我用了错误的 zypper 源(我用了 openSuse,而不是 SLE SP3)。

我先卸载了有问题的 pip,删除了错误的源,添加了正确的源,最后又重新安装了一遍 pip。这样就好了。

撰写回答