Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install specific version of python2 with homebrew

I've installed python 2.7.13 with homebrew but I need 2.7.10. It seems something trivial... I've seen similar questions like this or this but I haven't been able to install it.

I've tried to tap homebrew/versions and then do brew search python but there are no versions (rather than python2 and python3).

like image 271
dnaranjo Avatar asked Feb 18 '17 21:02

dnaranjo


1 Answers

Homebrew doesn't do this, I would recommend using homebrew to install pyenv and then using pyenv to install and use python 2.7.10, and any other versions you need.

Get pyenv:

brew update
brew install pyenv

Then add eval "$(pyenv init -)" to your .bash_profile and relaunch terminal.

Install python 2.7.10:

pyenv install 2.7.10

You can then set 2.7.10 as the global python by using pyenv global 2.7.10 but I would instead recommend you look at the pyenv virtualenv or pyenv virtualenvwrapper projects and use a python virtual environment for your code, or set the python for your project folder only by cd'ing to your project folder and using pyenv local 2.7.10.

like image 108
Alisdair Robertson Avatar answered Oct 07 '22 11:10

Alisdair Robertson