I looked at pypy, but if you think about it, you can change python just by changing environment variables. I thought about it now, so I installed it
Appropriate in order or proportion. As a prerequisite, XCode
, HomeBrew
and pip
are already installed.
First pypy installation
$ pip install pypy
Then install 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...
After that, collect the existing Python and set the environment
$ 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.
So, change the python to be executed at the end.
[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