在终端中 运行 任何 python-依赖 commands/programs 时出错

error while running any python-dependent commands/programs in terminal

我最近在我的机器上安装了 arch;安装 python。 /usr/bin/python 被符号链接到 /usr/bin/python3,后者本身是 /usr/bin/python3.4.
的符号链接 因为,我使用 python2.7,所以我继续将 python 链接到 python2.7
现在,当我尝试 python 依赖程序时,出现以下错误。

Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3084, in <module>
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 651, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 952, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 839, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==7.1.2' distribution was not found and is required by the application

我想知道出了什么问题。

/usr/bin 中的 pip 脚本绑定到 Python 3.4。小脚本只是一个引导脚本,用于从模块加载实际代码。 Python 2.7 中缺少该模块,因为您没有为它安装 pip

修复脚本以将第一行中的 /usr/bin/python 替换为 /usr/bin/python3,或者 install pip for Python 2.7.

或者,只有 link /usr/bin/python2 到 Python 2.7 并让 /usr/bin/python 指向 Python 3。很可能其他 Arch 程序依赖无论如何,那是Python 3。另见 "Proper way" to manage multiple versions of Python on archlinux.