centos安装pypy(含pypy下载地址)
今天ttlsa群友提问说pypy源码安装有问题,各种问题,有些人使用epel源yum安装,但是我发现我的epel没有pypy,在网上搜索了一番,找到了对应的rpm安装包,这边分享一下下载地址以及python与pypy的简单性能对比。
1. pypy rpm下载地址
http://pkgs.org/search/?keyword=pypy
2. 安装pypy
在下载地址中包含各个版本的pypy,有centos、redhat、ubuntu、debian等等.自行选择,我这边是centos6,如下:
(注意安装顺序,libs一定要先安装)
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-libs-2.0.2-1.el6.x86_64.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-libs-2.0.2-1.el6.x86_64.rpm
warning: /var/tmp/rpm-tmp.DTV0uQ: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:pypy-libs ########################################### [100%]
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-2.0.2-1.el6.x86_64.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-2.0.2-1.el6.x86_64.rpm
warning: /var/tmp/rpm-tmp.upV9H2: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:pypy ########################################### [100%]
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-devel-2.0.2-1.el6.x86_64.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-devel-2.0.2-1.el6.x86_64.rpm
warning: /var/tmp/rpm-tmp.YbOckH: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:pypy-devel ########################################### [100%]
# DateTime:2013-10-08
# 站点: www.ttlsa.com
# -------------------------------
def
check(num):
a
=
list
(
str
(num))
b
=
a[::
-
1
]
if
a
=
=
b:
return
True
return
False
def
main():
all
=
xrange
(
1
,
10
*
*
7
)
for
i
in
all
:
if
check(i):
if
check(i
*
*
2
):
print
i,i
*
*
2
if
__name__
=
=
'__main__'
:
main()
执行ttlsa_py.py
1
# time pypy ttlsa_py.py
2
1 1
3
.....中间省略掉
4
2001002 4004009004004
5
6
real 0m5.585s
7
user 0m5.496s
8
sys 0m0.039s
4. python与pypy性能对比
2
1 1
3
....中间省略掉
4
2001002 4004009004004
5
6
real 0m32.719s
7
user 0m32.654s
8
sys 0m0.012s
python使用了32.719秒,pypy使用了5.58秒,相差了将近6秒
5. 结束语
本文不是专业的测试,仅仅是分享一下rpm下载地址,以及演示安装过程,最后的测试代码也是网上摘抄的,至于python和pypy的性能,大家自行对比。
6. 参考文章
pypy介绍:http://zh.wikipedia.org/wiki/PyPy
python介绍:http://baike.baidu.com/link?url=U71_JLPdwnWVX1InA4_R6jAW38enEOatIKsFqCf_qzAyL_ZsgrwKRytaCGYhal_Z