pypy Je l'ai regardé, mais si vous y réfléchissez, vous pouvez changer python simplement en changeant les variables d'environnement. J'y ai pensé maintenant, alors je l'ai installé
Approprié dans l'ordre ou la proportion. En tant que condition préalable, XCode
, HomeBrew
et pip
sont déjà installés.
Installez d'abord pypy
$ pip install pypy
Puis installez virtualenv
$ sudo pip install virtualenv
Password:
Downloading/unpacking virtualenv
Downloading virtualenv-1.9.1.tar.gz (2.0MB): 2.0MB downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing virtualenv script to /usr/local/bin
Installing virtualenv-2.7 script to /usr/local/bin
Successfully installed virtualenv
Cleaning up...
Après cela, collectez le Python existant et définissez l'environnement
$ virtualenv -p `which pypy` pypy
Running virtualenv with interpreter /usr/local/bin/pypy
New pypy executable in pypy/bin/pypy
Installing setuptools............done.
Installing pip...............done.
$ virtualenv -p `which python` python_2_7_1
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in python_2_7_1/bin/python
Installing setuptools............done.
Installing pip...............done.
$ virtualenv -p `which python2.6` python_2_6_7
Running virtualenv with interpreter /usr/bin/python2.6
New python executable in python_2_6_7/bin/python2.6
Also creating executable in python_2_6_7/bin/python
Installing setuptools............................done.
Installing pip...............done.
Alors, changez le python à exécuter à la fin.
[yasui@yasui-MBA: ~][13:23] $ source ~/pypy/bin/activate
(pypy)[yasui@yasui-MBA: ~][13:23] $ python -V
Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:42:54)
[PyPy 1.9.0 with GCC 4.2.1]
(pypy)[yasui@yasui-MBA: ~][13:24] $
(pypy)[yasui@yasui-MBA: ~][13:24] $ source ~/python_2_7_1/bin/activate
(python_2_7_1)[yasui@yasui-MBA: ~][13:24] $ python -V
Python 2.7.1
(python_2_7_1)[yasui@yasui-MBA: ~][13:24] $
(python_2_7_1)[yasui@yasui-MBA: ~][13:24] $ source ~/python_2_6_7/bin/activate
(python_2_6_7)[yasui@yasui-MBA: ~][13:26] $ python -V
Python 2.6.7
(python_2_6_7)[yasui@yasui-MBA: ~][13:26] $
Recommended Posts