简体   繁体   中英

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).

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM