我最近在我的机器上设置了拱形;安装了python。 // type of functions being binary operations
typedef int (binary_operation*)(int, int);
// now you can define any binary operation on ints
int add_op(int a, int b) { // definition };
int mul_op(int a, int b) { // definition };
// main...
binary_operation f;
if (oper == "+")
f = add_op;
sum = f(in1,int2);
符号链接到/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
我想知道出了什么问题。
答案 0 :(得分:2)
pip
中的/usr/bin
脚本与Python 3.4绑定。小脚本只是一个引导脚本,用于从模块加载实际代码。 Python 2.7中缺少该模块,因为您没有为它安装pip
。
修复脚本以使用/usr/bin/python
或install pip
for Python 2.7替换第一行中的/usr/bin/python3
。
或者,只将/usr/bin/python2
链接到Python 2.7并让/usr/bin/python
指向Python 3.无论如何,其他Arch程序很可能依赖于Python 3。另请参阅"Proper way" to manage multiple versions of Python on archlinux。