Aufgrund verschiedener Versuche und Fehler bei der Installation von PyPy unter CentOS war es ausreichend, es aus dem Epel-Repository zu entfernen, sodass ich eine Notiz hinterlassen werde. Sie können die Quelle löschen und kompilieren, aber auf den herausfordernden Typ vorbereitet sein, da er viel Speicher und Zeit verbraucht.
Da der Text lang und voller Protokolle war, werden nur die erforderlichen Befehle aufgelistet. Laden Sie einfach das RPM-Paket aus dem Epel-Repository herunter.
# yum --enablerepo=epel,rpmforge,remi search pypy
# yum --enablerepo=epel,rpmforge,remi info pypy
# yum --enablerepo=epel install pypy
# yum --enablerepo=epel install pypy-devel
Ich habe die folgenden zwei Methoden zum Herunterladen von der PyPy-Seite ausprobiert.
Also habe ich mich entschlossen, das RPM-Paket im Repository zu suchen.
Überprüfen Sie vorerst die Version von CentOS.
# cat /etc/redhat-release
CentOS release 6.5 (Final)
Ich habe eine Yum-Suche mit der Option --enablerepo durchgeführt und angegeben, dass in den Repositories epel, rpmforge und remi gesucht werden soll. Wenn Sie das Repository überhaupt nicht hinzugefügt haben, fügen Sie es bitte unter Bezugnahme auf den folgenden Artikel hinzu.
# yum --enablerepo=epel,rpmforge,remi search pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* remi: remi.kazukioishi.net
* rpmforge: ftp.kddilabs.jp
* updates: ftp.iij.ad.jp
=================================================================== N/S Matched: pypy ===================================================================
pypy-devel.i686 : Development tools for working with PyPy
pypy-devel.x86_64 : Development tools for working with PyPy
pypy-libs.x86_64 : Run-time libraries used by PyPy implementations of Python
pypy.x86_64 : Python implementation with a Just-In-Time compiler
Name and summary matches only, use "search all" for everything.
Da yum search nicht weiß, welches Repository über PyPy verfügt, wird es durch yum info angegeben. Überprüfen Sie auch die Version.
# yum --enablerepo=epel,rpmforge,remi info pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* remi: remi.kazukioishi.net
* rpmforge: ftp.kddilabs.jp
* updates: ftp.iij.ad.jp
Available Packages
Name : pypy
Arch : x86_64
Version : 2.0.2
Release : 1.el6
Size : 7.3 M
Repo : epel
Summary : Python implementation with a Just-In-Time compiler
URL : http://pypy.org/
License : MIT and Python and UCD
Description : PyPy's implementation of Python, featuring a Just-In-Time compiler on some CPU
: architectures, and various optimized implementations of the standard types
: (strings, dictionaries, etc)
:
:
: This build of PyPy has JIT-compilation enabled.
Nach den bisherigen Informationen befindet sich pypy im epel-Repository. Geben Sie also epel für --enablerepo an und installieren Sie es.
# yum --enablerepo=epel install pypy
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pypy.x86_64 0:2.0.2-1.el6 will be installed
--> Processing Dependency: pypy-libs = 2.0.2-1.el6 for package: pypy-2.0.2-1.el6.x86_64
--> Running transaction check
---> Package pypy-libs.x86_64 0:2.0.2-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================
Installing:
pypy x86_64 2.0.2-1.el6 epel 7.3 M
Installing for dependencies:
pypy-libs x86_64 2.0.2-1.el6 epel 5.0 M
Transaction Summary
=========================================================================================================================================================
Install 2 Package(s)
Total download size: 12 M
Installed size: 70 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): pypy-2.0.2-1.el6.x86_64.rpm | 7.3 MB 00:01
(2/2): pypy-libs-2.0.2-1.el6.x86_64.rpm | 5.0 MB 00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.6 MB/s | 12 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : pypy-libs-2.0.2-1.el6.x86_64 1/2
Installing : pypy-2.0.2-1.el6.x86_64 2/2
Verifying : pypy-2.0.2-1.el6.x86_64 1/2
Verifying : pypy-libs-2.0.2-1.el6.x86_64 2/2
Installed:
pypy.x86_64 0:2.0.2-1.el6
Dependency Installed:
pypy-libs.x86_64 0:2.0.2-1.el6
Complete!
Lassen Sie uns vorerst entwickeln.
# yum --enablerepo=epel install pypy-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* remi: remi.kazukioishi.net
* rpmforge: ftp.kddilabs.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pypy-devel.x86_64 0:2.0.2-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================
Installing:
pypy-devel x86_64 2.0.2-1.el6 epel 35 k
Transaction Summary
=========================================================================================================================================================
Install 1 Package(s)
Total download size: 35 k
Installed size: 88 k
Is this ok [y/N]: y
Downloading Packages:
pypy-devel-2.0.2-1.el6.x86_64.rpm | 35 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pypy-devel-2.0.2-1.el6.x86_64 1/1
Verifying : pypy-devel-2.0.2-1.el6.x86_64 1/1
Installed:
pypy-devel.x86_64 0:2.0.2-1.el6
Complete!
Hello World
Führen Sie die klassische Hello World aus.
$ pypy
Python 2.7.3 (f66246c46ca30b26a5c73e4cc95dd6235c966b8f, Jul 30 2013, 09:27:06)
[PyPy 2.0.2 with GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> print("Hello World")
Hello World
Es wurde angezeigt.
Vergleichen Sie die Ausführungszeit mit der in [Vergleich der Ausführungszeit von CPython und PyPy] verwendeten Funktion (http://qiita.com/intermezzo-fr/items/9fcd4abc6991ea52295c).
CPython
>>> rangelist = range(1,10000000)
>>> print reduce(lambda x, y: x + y, [testfunc1(rangelist) for temp in range(10)])/10
0:00:01.717502
>>> print reduce(lambda x, y: x + y, [testfunc2(rangelist) for temp in range(10)])/10
0:00:01.183652
>>> print reduce(lambda x, y: x + y, [testfunc3(rangelist) for temp in range(10)])/10
0:00:00.734407
PyPy
>>> rangelist = range(1,10000000)
>>> print reduce(lambda x, y: x + y, [testfunc1(rangelist) for temp in range(10)])/10
0:00:01.017655
>>> print reduce(lambda x, y: x + y, [testfunc2(rangelist) for temp in range(10)])/10
0:00:00.983054
>>> print reduce(lambda x, y: x + y, [testfunc3(rangelist) for temp in range(10)])/10
0:00:00.250842
Die Ausführungszeit in PyPy ist viel kürzer als in CPython.
Recommended Posts